diff options
author | kinichiro <kinichiro.inoguchi@gmail.com> | 2016-04-07 15:10:01 +0900 |
---|---|---|
committer | Brent Cook <bcook@openbsd.org> | 2016-04-09 13:37:09 -0500 |
commit | c94670a8cd39f8a8843e9adba2a6030adb00ac94 (patch) | |
tree | 05e30bb91d42c1d56abe767dc718c9affb82d8d9 | |
parent | 752ad82d33bef07591ae323e17de2cb8f0e50e20 (diff) | |
download | portable-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
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | cmake_uninstall.cmake.in | 21 |
3 files changed, 30 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index cecaafe..9e12909 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -224,3 +224,11 @@ if(NOT MSVC) | |||
224 | add_subdirectory(man) | 224 | add_subdirectory(man) |
225 | add_subdirectory(tests) | 225 | add_subdirectory(tests) |
226 | endif() | 226 | endif() |
227 | |||
228 | configure_file( | ||
229 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" | ||
230 | "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" | ||
231 | IMMEDIATE @ONLY) | ||
232 | |||
233 | add_custom_target(uninstall | ||
234 | COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) | ||
diff --git a/Makefile.am b/Makefile.am index d92f347..48da18b 100644 --- a/Makefile.am +++ b/Makefile.am | |||
@@ -5,7 +5,7 @@ pkgconfigdir = $(libdir)/pkgconfig | |||
5 | pkgconfig_DATA = libcrypto.pc libssl.pc libtls.pc openssl.pc | 5 | pkgconfig_DATA = libcrypto.pc libssl.pc libtls.pc openssl.pc |
6 | 6 | ||
7 | EXTRA_DIST = README.md README.windows VERSION config scripts | 7 | EXTRA_DIST = README.md README.windows VERSION config scripts |
8 | EXTRA_DIST += CMakeLists.txt | 8 | EXTRA_DIST += CMakeLists.txt cmake_uninstall.cmake.in |
9 | 9 | ||
10 | .PHONY: install_sw | 10 | .PHONY: install_sw |
11 | install_sw: install | 11 | install_sw: install |
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 @@ | |||
1 | if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | ||
2 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | ||
3 | endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | ||
4 | |||
5 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) | ||
6 | string(REGEX REPLACE "\n" ";" files "${files}") | ||
7 | foreach(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}") | ||
21 | endforeach(file) | ||