diff options
author | Antenore Gatta (tmow) <antenore@simbiosi.org> | 2021-07-14 17:27:08 +0300 |
---|---|---|
committer | Antenore Gatta (tmow) <antenore@simbiosi.org> | 2021-07-14 17:27:08 +0300 |
commit | 460d70a5c28464c1e350d7c2a478f36e11864394 (patch) | |
tree | 7bd727bec67711c41ea8b1dde127685d04760077 /CMakeLists.txt | |
parent | 7e94add2002bf4e2b7a8e6130b78656442de966a (diff) |
Improved uninstall target. closes 2314
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 46cd55479..cf5418b2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -357,11 +357,23 @@ if(SNAP_BUILD) endif() # Uninstall support -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) -add_custom_target(uninstall "${CMAKE_COMMAND}" -P - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") + +# setup a 'make uninstall' target if we find a +# cmake_uninstall.cmake.in in the module path +#=========================================================== +foreach( MODULE_PATH ${CMAKE_MODULE_PATH} ) + set( UNINSTALL_IN "${MODULE_PATH}/cmake_uninstall.cmake.in" ) + set( UNINSTALL_OUT "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" ) + if( EXISTS ${UNINSTALL_IN} ) + configure_file( "${UNINSTALL_IN}" + "${UNINSTALL_OUT}" + IMMEDIATE @ONLY + ) + add_custom_target(uninstall + "${CMAKE_COMMAND}" -P "${UNINSTALL_OUT}") + break() + endif( EXISTS ${UNINSTALL_IN} ) +endforeach( MODULE_PATH ) #find_required_package(GTK) find_package(GLib REQUIRED) |