From b03987c495b75b5d873f932b1ff3fc27c1494c87 Mon Sep 17 00:00:00 2001 From: SB Olivia Date: Mon, 4 Dec 2023 10:29:52 -0500 Subject: [PATCH] only create uninstall target if doesn't exist already (#612) --- CMakeLists.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1eb48c2d4..d03ebe301 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -358,12 +358,14 @@ install(FILES package.xml ) # Add uninstall target -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/CMakeModules/cmake_uninstall.cmake" - IMMEDIATE @ONLY) -add_custom_target(uninstall - "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/CMakeModules/cmake_uninstall.cmake") +if(NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/CMakeModules/cmake_uninstall.cmake" + IMMEDIATE @ONLY) + add_custom_target(uninstall + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/CMakeModules/cmake_uninstall.cmake") +endif() set(FCL_BUILD_TESTS "DEFAULT" CACHE INTERNAL "Deprecated; use BUILD_TESTING instead.")