diff options
| author | Eduard Braun <eduard.braun2@gmx.de> | 2017-07-20 21:46:12 +0000 |
|---|---|---|
| committer | Eduard Braun <eduard.braun2@gmx.de> | 2017-07-20 22:21:55 +0000 |
| commit | fbd2c9a9e0c4633817c7b4f0f61c06582afbb674 (patch) | |
| tree | 89541bf7a106bc7376d537ad9288e784650cb209 | |
| parent | cmake: cleanup man page generation (diff) | |
| download | inkscape-fbd2c9a9e0c4633817c7b4f0f61c06582afbb674.tar.gz inkscape-fbd2c9a9e0c4633817c7b4f0f61c06582afbb674.zip | |
cmake: update uninstall target
- update cmake_uninstall.cmake.in from
https://cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
and move the file to /CMakeScripts
- on WIN32 simply delete the whole distribution directory
(should be sufficient ant the script version is unbearably slow)
| -rw-r--r-- | CMakeLists.txt | 20 | ||||
| -rw-r--r-- | CMakeScripts/cmake_uninstall.cmake.in | 21 | ||||
| -rw-r--r-- | cmake_uninstall.cmake.in | 23 |
3 files changed, 33 insertions, 31 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c91713ee9..a42a317fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -177,13 +177,17 @@ add_custom_target(dist # ----------------------------------------------------------------------------- # Uninstall Target # ----------------------------------------------------------------------------- -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") +if(WIN32) + add_custom_target(uninstall + "${CMAKE_COMMAND}" -E remove_directory "${CMAKE_INSTALL_PREFIX}") +else() + configure_file( + "${CMAKE_SOURCE_DIR}/CMakeScripts/cmake_uninstall.cmake.in" + "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" + @ONLY) + add_custom_target(uninstall + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") +endif() # ----------------------------------------------------------------------------- @@ -198,7 +202,7 @@ endif(ENABLE_NLS) if(NOT WIN32) include(CMakeScripts/Pod2man.cmake) add_subdirectory(man) -endif(NOT WIN32) +endif() # ----------------------------------------------------------------------------- # Installation diff --git a/CMakeScripts/cmake_uninstall.cmake.in b/CMakeScripts/cmake_uninstall.cmake.in new file mode 100644 index 000000000..2037e3653 --- /dev/null +++ b/CMakeScripts/cmake_uninstall.cmake.in @@ -0,0 +1,21 @@ +if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") +endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling $ENV{DESTDIR}${file}") + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + exec_program( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") + endif(NOT "${rm_retval}" STREQUAL 0) + else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") +endforeach(file) diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in deleted file mode 100644 index cd2001a16..000000000 --- a/cmake_uninstall.cmake.in +++ /dev/null @@ -1,23 +0,0 @@ -IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") - MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") -ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") - -FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) -STRING(REGEX REPLACE "\n" ";" files "${files}") -FOREACH(file ${files}) - MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") - IF(EXISTS "$ENV{DESTDIR}${file}") - EXEC_PROGRAM( - "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" - OUTPUT_VARIABLE rm_out - RETURN_VALUE rm_retval - ) - IF("${rm_retval}" STREQUAL 0) - ELSE("${rm_retval}" STREQUAL 0) - MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") - ENDIF("${rm_retval}" STREQUAL 0) - ELSE(EXISTS "$ENV{DESTDIR}${file}") - MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") - ENDIF(EXISTS "$ENV{DESTDIR}${file}") -ENDFOREACH(file) - |
