diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in index 2d6c62c08..856ddd302 100644 --- a/cmake_uninstall.cmake.in +++ b/cmake_uninstall.cmake.in @@ -19,8 +19,17 @@ IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") RETURN() ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") +IF(NOT DEFINED PACKAGE_CREATES_DOT_CATKIN OR NOT "${PACKAGE_PREVIOUS_INSTALL_PREFIX}" EQUAL "${CMAKE_INSTALL_PREFIX}") + SET(PACKAGE_PREVIOUS_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "Cache install prefix given to the package") + IF(EXISTS "${CMAKE_INSTALL_PREFIX}/.catkin") + SET(PACKAGE_CREATES_DOT_CATKIN FALSE CACHE INTERNAL "") + ELSE() + SET(PACKAGE_CREATES_DOT_CATKIN TRUE CACHE INTERNAL "") + ENDIF() +ENDIF() + MESSAGE(STATUS "catkin path: @CMAKE_INSTALL_PREFIX@/.catkin") -IF(EXISTS "@CMAKE_INSTALL_PREFIX@/.catkin") +IF(EXISTS "@CMAKE_INSTALL_PREFIX@/.catkin" AND NOT PACKAGE_CREATES_DOT_CATKIN) MESSAGE(STATUS "Try to remove @CMAKE_INSTALL_PREFIX@/.catkin") EXECUTE_PROCESS( COMMAND @CMAKE_COMMAND@ -E remove "@CMAKE_INSTALL_PREFIX@/.catkin" @@ -28,7 +37,7 @@ IF(EXISTS "@CMAKE_INSTALL_PREFIX@/.catkin") OUTPUT_VARIABLE rm_out ERROR_VARIABLE rm_err ) -ENDIF(EXISTS "@CMAKE_INSTALL_PREFIX@/.catkin") +ENDIF(EXISTS "@CMAKE_INSTALL_PREFIX@/.catkin" AND NOT PACKAGE_CREATES_DOT_CATKIN) IF(EXISTS "@CMAKE_CURRRENT_BINARY_DIR@/install_manifest.txt") return()