From 807ace309a489d21163b5c671d9e449c06e14e20 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Sun, 1 Feb 2015 11:20:43 +0000 Subject: Add a module to provide an uninstall target. This is basically just the code available on the CMake FAQ item about `make uninstall`, but packaged up in a convenient module. REVIEW: 122359 --- modules/ecm_uninstall.cmake.in | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 modules/ecm_uninstall.cmake.in (limited to 'modules/ecm_uninstall.cmake.in') diff --git a/modules/ecm_uninstall.cmake.in b/modules/ecm_uninstall.cmake.in new file mode 100644 index 00000000..d0cf1241 --- /dev/null +++ b/modules/ecm_uninstall.cmake.in @@ -0,0 +1,21 @@ +if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") +endif() + +file(READ "@CMAKE_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() + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif() +endforeach() -- cgit v1.2.1 From 0772adcc6d4600c54ef6f97b4e8a5e3d298af9f5 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Fri, 6 Feb 2015 15:00:52 +0100 Subject: Minor: Cleanup --- modules/ecm_uninstall.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/ecm_uninstall.cmake.in') diff --git a/modules/ecm_uninstall.cmake.in b/modules/ecm_uninstall.cmake.in index d0cf1241..379239ba 100644 --- a/modules/ecm_uninstall.cmake.in +++ b/modules/ecm_uninstall.cmake.in @@ -14,7 +14,7 @@ foreach(file ${files}) ) if(NOT "${rm_retval}" STREQUAL 0) message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") - endif(NOT "${rm_retval}" STREQUAL 0) + endif() else() message(STATUS "File $ENV{DESTDIR}${file} does not exist.") endif() -- cgit v1.2.1