[geos-commits] r2934 - in trunk: . cmake

svn_geos at osgeo.org svn_geos at osgeo.org
Fri Mar 5 20:49:46 EST 2010


Author: mloskot
Date: 2010-03-05 20:49:44 -0500 (Fri, 05 Mar 2010)
New Revision: 2934

Added:
   trunk/cmake/cmake_uninstall.cmake.in
Modified:
   trunk/CMakeLists.txt
Log:
Added cmake/cmake_uninstall.cmake.in script and configured make uninstall target for CMake configuration (#317)

Modified: trunk/CMakeLists.txt
===================================================================
--- trunk/CMakeLists.txt	2010-03-03 07:21:06 UTC (rev 2933)
+++ trunk/CMakeLists.txt	2010-03-06 01:49:44 UTC (rev 2934)
@@ -15,7 +15,8 @@
 cmake_minimum_required(VERSION 2.6)
 
 if(NOT CMAKE_VERSION)
-    set(CMAKE_VERSION "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
+    set(CMAKE_VERSION
+      "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
 endif()
 
 # Location of custom CMake modules with macros used by GEOS
@@ -271,9 +272,16 @@
 add_subdirectory(tools)
 
 #################################################################################
-# Setup installation of common files not specific to any target
+# Install/Uninstall
+#################################################################################
 
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
+  "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
+  IMMEDIATE @ONLY)
 
+add_custom_target(uninstall
+  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake") 
+
 #################################################################################
 # DEBUG settings - TODO: make a summary
 

Added: trunk/cmake/cmake_uninstall.cmake.in
===================================================================
--- trunk/cmake/cmake_uninstall.cmake.in	                        (rev 0)
+++ trunk/cmake/cmake_uninstall.cmake.in	2010-03-06 01:49:44 UTC (rev 2934)
@@ -0,0 +1,49 @@
+#################################################################################
+# $Id: CMakeLists.txt 2920 2010-02-21 17:11:38Z mloskot $
+#
+# This file is a part of CMake build configuration of GEOS library
+#
+# Defines commands used by make uninstall target of CMake build configuration.
+#
+# Author: Credit to the CMake mailing list archives for providing this solution. 
+# Modifications: Mateusz Loskot <mateusz at loskot.net>
+#
+#################################################################################
+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()
+
+file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+string(REGEX REPLACE "\n" ";" files "${files}")
+
+set(GEOS_INCLUDE_DIR)
+foreach(file ${files})
+
+  if(${file} MATCHES "geos.h")
+    get_filename_component(GEOS_INCLUDE_DIR ${file} PATH)
+  endif()
+
+  message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
+  if(NOT EXISTS "$ENV{DESTDIR}${file}")
+    message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
+    message(STATUS "\tTrying to execute remove command anyway.")
+  endif()
+
+  exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+    OUTPUT_VARIABLE rm_out
+    RETURN_VALUE rm_retval)
+  if(NOT "${rm_retval}" STREQUAL 0)
+    message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
+  endif()
+endforeach()
+
+message(STATUS "Deleting ${GEOS_INCLUDE_DIR} directory")
+exec_program("@CMAKE_COMMAND@" 
+  ARGS "-E remove_directory \"${GEOS_INCLUDE_DIR}\""
+  OUTPUT_VARIABLE rm_out
+  RETURN_VALUE rm_retval)
+if(NOT "${rm_retval}" STREQUAL 0)
+  message(FATAL_ERROR "Problem when removing \"${GEOS_INCLUDE_DIR}\"")
+endif()



More information about the geos-commits mailing list