# HG changeset patch # User Sebastien Jodogne # Date 1380716524 -7200 # Node ID 0cef1adc056024abda1c5e0fa1773a04584881fa # Parent a042693cc6a9493b00896495a48c7178d711fd2b# Parent b2357f1f026f0a68c8732b3be7106014c01c6089 merge diff -r b2357f1f026f -r 0cef1adc0560 CMakeLists.txt --- 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) diff -r b2357f1f026f -r 0cef1adc0560 NEWS --- 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) diff -r b2357f1f026f -r 0cef1adc0560 Resources/CMake/Uninstall.cmake.in --- /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)