From ffc4e59bfce83d0377a47c7bf58d5a25907c37b9 Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco Claraco Date: Fri, 5 Feb 2021 02:24:40 +0100 Subject: [PATCH] Avoid target collision if gtsam used as submodule --- cmake/HandleUninstall.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmake/HandleUninstall.cmake b/cmake/HandleUninstall.cmake index 1859b0273..dccb1905e 100644 --- a/cmake/HandleUninstall.cmake +++ b/cmake/HandleUninstall.cmake @@ -6,5 +6,11 @@ configure_file( "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) -add_custom_target(uninstall - "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") +if (NOT TARGET uninstall) # avoid duplicating this target + add_custom_target(uninstall + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") +else() + add_custom_target(uninstall_gtsam + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") + add_dependencies(uninstall uninstall_gtsam) +endif()