diff options
author | Allen Winter <allen.winter@kdab.com> | 2017-03-24 18:37:22 -0400 |
---|---|---|
committer | Allen Winter <allen.winter@kdab.com> | 2017-03-24 18:37:22 -0400 |
commit | 1c10ad23a4b2f59127cfd372e90c03d4abaee4fa (patch) | |
tree | d924d95993f1a54c2182a34bf51d3e448dba8187 /uninstall.cmake.in | |
parent | 29cd90c21b487b5b4335059ed1a8bf7e5822a170 (diff) | |
download | libical-git-1c10ad23a4b2f59127cfd372e90c03d4abaee4fa.tar.gz |
CMakeLists.txt - add an 'uninstall' build target
ISSUE: 290
Diffstat (limited to 'uninstall.cmake.in')
-rw-r--r-- | uninstall.cmake.in | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/uninstall.cmake.in b/uninstall.cmake.in new file mode 100644 index 00000000..662668c7 --- /dev/null +++ b/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() + +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() + else() + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif() +endforeach() |