Skip to content

Commit ac144ed

Browse files
MegamouseMegamousejbeder
authored
Hide uninstall target unless YAML_CPP_INSTALL is set, and allow it to be disabled by YAML_CPP_DISABLE_UNINSTALL
add_custom_target uninstall causes a clash with the same target in rtmidi (https://github.com/thestk/rtmidi). "add_custom_target cannot create target "uninstall" because another target with the same name already exists. The existing target is a custom target created in source directory" Adds new option YAML_CPP_DISABLE_UNINSTALL fixes #1151 --------- Co-authored-by: Megamouse <[email protected]> Co-authored-by: Jesse Beder <[email protected]>
1 parent 4c061a5 commit ac144ed

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ option(YAML_CPP_BUILD_TOOLS "Enable parse tools" ON)
2626
option(YAML_BUILD_SHARED_LIBS "Build yaml-cpp shared library" ${BUILD_SHARED_LIBS})
2727
option(YAML_CPP_INSTALL "Enable generation of yaml-cpp install targets" ${YAML_CPP_MAIN_PROJECT})
2828
option(YAML_CPP_FORMAT_SOURCE "Format source" ${YAML_CPP_MAIN_PROJECT})
29+
option(YAML_CPP_DISABLE_UNINSTALL "Disable uninstallation of yaml-cpp" OFF)
30+
2931
cmake_dependent_option(YAML_CPP_BUILD_TESTS
3032
"Enable yaml-cpp tests" OFF
3133
"BUILD_TESTING;YAML_CPP_MAIN_PROJECT" OFF)
@@ -197,7 +199,7 @@ if (YAML_CPP_FORMAT_SOURCE AND YAML_CPP_CLANG_FORMAT_EXE)
197199
endif()
198200

199201
# uninstall target
200-
if(NOT TARGET uninstall)
202+
if(YAML_CPP_INSTALL AND NOT YAML_CPP_DISABLE_UNINSTALL AND NOT TARGET uninstall)
201203
configure_file(
202204
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
203205
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"

0 commit comments

Comments
 (0)