[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Discussion on #allegro suggested that an uninstall target might be an
attractive feature for A5. I just implemented the suggestion at
http://www.paraview.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
and it seems to work fine when I tested it on Linux. The patch is attached.
-SL
Index: cmake/cmake_uninstall.cmake.in
===================================================================
--- cmake/cmake_uninstall.cmake.in (revision 0)
+++ cmake/cmake_uninstall.cmake.in (revision 0)
@@ -0,0 +1,23 @@
+# From: http://www.paraview.org/Wiki/CMake_FAQ
+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}")
+FOREACH(file ${files})
+ MESSAGE(STATUS "Uninstalling \"${file}\"")
+ IF(EXISTS "${file}")
+ EXEC_PROGRAM(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ IF("${rm_retval}" STREQUAL 0)
+ ELSE("${rm_retval}" STREQUAL 0)
+ MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"")
+ ENDIF("${rm_retval}" STREQUAL 0)
+ ELSE(EXISTS "${file}")
+ MESSAGE(STATUS "File \"${file}\" does not exist.")
+ ENDIF(EXISTS "${file}")
+ENDFOREACH(file)
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 13760)
+++ CMakeLists.txt (working copy)
@@ -923,4 +923,17 @@
endif(WANT_DOCS)
#-----------------------------------------------------------------------------#
+#
+# Uninstall
+#
+#-----------------------------------------------------------------------------#
+CONFIGURE_FILE(
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+ @ONLY)
+ADD_CUSTOM_TARGET(uninstall
+ "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
+
+
+#-----------------------------------------------------------------------------#
# vim: set sts=4 sw=4 et: