changeset 586:0cef1adc0560

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 02 Oct 2013 14:22:04 +0200
parents a042693cc6a9 (diff) b2357f1f026f (current diff)
children 8b6ae96125dc
files
diffstat 3 files changed, 40 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Tue Oct 01 16:38:14 2013 +0200
+++ b/CMakeLists.txt	Wed Oct 02 14:22:04 2013 +0200
@@ -377,3 +377,17 @@
 else()
   message("Doxygen not found. The documentation will not be built.")
 endif()
+
+
+#####################################################################
+## Prepare the "uninstall" target
+## http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
+#####################################################################
+
+configure_file(
+    "${CMAKE_CURRENT_SOURCE_DIR}/Resources/CMake/Uninstall.cmake.in"
+    "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+    IMMEDIATE @ONLY)
+
+add_custom_target(uninstall
+    COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
--- a/NEWS	Tue Oct 01 16:38:14 2013 +0200
+++ b/NEWS	Wed Oct 02 14:22:04 2013 +0200
@@ -5,6 +5,7 @@
 * Improvements and documentation of the C++ client API
 * Fix of Debian bug #724947 (licensing issue with the SHA-1 library)
 * Switch to Boost 1.54.0 (cf. issue #9)
+* "make uninstall" is now possible
 
 
 Version 0.6.1 (2013/09/16)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CMake/Uninstall.cmake.in	Wed Oct 02 14:22:04 2013 +0200
@@ -0,0 +1,25 @@
+# Code taken from the CMake FAQ
+# http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
+
+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(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+string(REGEX REPLACE "\n" ";" files "${files}")
+list(REVERSE files)
+foreach (file ${files})
+  message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
+  if (EXISTS "$ENV{DESTDIR}${file}")
+    execute_process(
+      COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
+      OUTPUT_VARIABLE rm_out
+      RESULT_VARIABLE rm_retval
+      )
+    if(NOT ${rm_retval} EQUAL 0)
+      message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
+    endif (NOT ${rm_retval} EQUAL 0)
+  else (EXISTS "$ENV{DESTDIR}${file}")
+    message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
+  endif (EXISTS "$ENV{DESTDIR}${file}")
+endforeach(file)