Skip to content

Commit df10571

Browse files
authored
Only add the uninstall target if the C driver is the top level project (#1352)
Only add the `uninstall` target if the C driver is the top level project. The `uninstall` target was conflicting with the C++ driver's `uninstall` target. This fixes the conflict.
1 parent 3a3b3f7 commit df10571

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

generate_uninstall/CMakeLists.txt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ if (WIN32)
2828
")
2929
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}" DESTINATION "${UNINSTALL_PROG_DIR}" PERMISSIONS ${UNINSTALL_PERMISSIONS})
3030

31-
add_custom_target (uninstall
32-
COMMAND call "${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}"
33-
)
31+
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}")
32+
# Define the `uninstall` target if the C driver is the top-level project.
33+
add_custom_target (uninstall
34+
COMMAND call "${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}"
35+
)
36+
endif ()
3437
else ()
3538
install (CODE "
3639
string(REPLACE \";\" \"\\n\" MONGOC_INSTALL_MANIFEST_CONTENT
@@ -50,7 +53,10 @@ else ()
5053
")
5154
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}" DESTINATION "${UNINSTALL_PROG_DIR}" PERMISSIONS ${UNINSTALL_PERMISSIONS})
5255

53-
add_custom_target (uninstall
54-
COMMAND sh "${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}"
55-
)
56+
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}")
57+
# Define the `uninstall` target if the C driver is the top-level project.
58+
add_custom_target (uninstall
59+
COMMAND sh "${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}"
60+
)
61+
endif ()
5662
endif ()

0 commit comments

Comments
 (0)