[SCM] OCE packaging branch, upstream, updated. OCE-0.6.0-230-g17bea23

tpaviot tpaviot at gmail.com
Fri Feb 24 18:50:15 UTC 2012


The following commit has been merged in the upstream branch:
commit 4bfd09847d043bd1b0e635a98e5e9510ec9cd276
Author: tpaviot <tpaviot at gmail.com>
Date:   Fri Jan 6 06:18:19 2012 +0100

    Added uninstall
    
    From
    http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 186591f..a6dd0fc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1144,3 +1144,15 @@ if( CPACK_GENERATOR MATCHES ".*RPM.*" )
 endif()
 
 INCLUDE(CPack)
+
+########################################################################################
+# Uninstall code                                                                       #
+# From http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F #
+# ######################################################################################
+configure_file(
+    "${CMAKE_CURRENT_SOURCE_DIR}/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 --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in
new file mode 100644
index 0000000..4a2a55c
--- /dev/null
+++ b/cmake_uninstall.cmake.in
@@ -0,0 +1,22 @@
+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)
\ No newline at end of file

-- 
OCE packaging



More information about the debian-science-commits mailing list