summaryrefslogtreecommitdiff
path: root/uninstall.cmake.in
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2017-03-24 18:37:22 -0400
committerAllen Winter <allen.winter@kdab.com>2017-03-24 18:37:22 -0400
commit1c10ad23a4b2f59127cfd372e90c03d4abaee4fa (patch)
treed924d95993f1a54c2182a34bf51d3e448dba8187 /uninstall.cmake.in
parent29cd90c21b487b5b4335059ed1a8bf7e5822a170 (diff)
downloadlibical-git-1c10ad23a4b2f59127cfd372e90c03d4abaee4fa.tar.gz
CMakeLists.txt - add an 'uninstall' build target
ISSUE: 290
Diffstat (limited to 'uninstall.cmake.in')
-rw-r--r--uninstall.cmake.in21
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()