aboutsummaryrefslogtreecommitdiff
path: root/cmake_uninstall.cmake.in
diff options
context:
space:
mode:
authorkinichiro <kinichiro.inoguchi@gmail.com>2016-04-07 15:10:01 +0900
committerBrent Cook <bcook@openbsd.org>2016-04-09 13:37:09 -0500
commitc94670a8cd39f8a8843e9adba2a6030adb00ac94 (patch)
tree05e30bb91d42c1d56abe767dc718c9affb82d8d9 /cmake_uninstall.cmake.in
parent752ad82d33bef07591ae323e17de2cb8f0e50e20 (diff)
downloadportable-c94670a8cd39f8a8843e9adba2a6030adb00ac94.tar.gz
portable-c94670a8cd39f8a8843e9adba2a6030adb00ac94.tar.bz2
portable-c94670a8cd39f8a8843e9adba2a6030adb00ac94.zip
add cmake uninstall functionality
- add uninstall functionality * see https://cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
Diffstat (limited to 'cmake_uninstall.cmake.in')
-rw-r--r--cmake_uninstall.cmake.in21
1 files changed, 21 insertions, 0 deletions
diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in
new file mode 100644
index 0000000..bb8055d
--- /dev/null
+++ b/cmake_uninstall.cmake.in
@@ -0,0 +1,21 @@
1if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
2 message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
3endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
4
5file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
6string(REGEX REPLACE "\n" ";" files "${files}")
7foreach(file ${files})
8 message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
9 if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
10 exec_program(
11 "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
12 OUTPUT_VARIABLE rm_out
13 RETURN_VALUE rm_retval
14 )
15 if(NOT "${rm_retval}" STREQUAL 0)
16 message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
17 endif(NOT "${rm_retval}" STREQUAL 0)
18 else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
19 message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
20 endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
21endforeach(file)