[geos-commits] r3861 - in trunk: . tools
svn_geos at osgeo.org
svn_geos at osgeo.org
Sat Aug 3 08:37:46 PDT 2013
Author: mloskot
Date: 2013-08-03 08:37:46 -0700 (Sat, 03 Aug 2013)
New Revision: 3861
Added:
trunk/tools/geos_svn_revision_cmake.h.in
Modified:
trunk/CMakeLists.txt
Log:
Add geos_svn_revision.h generator to CMake config
Patch from David Burken attached to #643
Modified: trunk/CMakeLists.txt
===================================================================
--- trunk/CMakeLists.txt 2013-08-02 22:38:59 UTC (rev 3860)
+++ trunk/CMakeLists.txt 2013-08-03 15:37:46 UTC (rev 3861)
@@ -237,20 +237,46 @@
# Setup checks and generate config headers
#################################################################################
+#################################################################################
+# MACRO: GET_SVN_REVISION
+#
+# DESCRIPTION:
+# MACRO FOR GETTING THE SVN revision for this build
+#################################################################################
+MACRO (GET_SVN_REVISION)
+ FIND_PACKAGE(Subversion)
+ IF(SUBVERSION_FOUND)
+ Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Project)
+ # MESSAGE("Current revision is ${Project_WC_REVISION}")
+ # Subversion_WC_LOG(${PROJECT_SOURCE_DIR} Project)
+ # MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}")
+ ENDIF()
+ENDMACRO(GET_SVN_REVISION)
+
# Determine SVN/Git revision
-message(STATUS "Generating revision header ${CMAKE_SOURCE_DIR}/geos_svn_revision.h")
-find_program(SH sh)
-if(SH)
- execute_process(COMMAND ${SH} -c
- "cd ${CMAKE_SOURCE_DIR} && ${CMAKE_SOURCE_DIR}/tools/svn_repo_revision.sh")
+GET_SVN_REVISION()
+if ( NOT ${Project_WC_REVISION} EQUAL 0 )
+ set( GEOS_SVN_REVISION ${Project_WC_REVISION} )
+ configure_file (
+ "${PROJECT_SOURCE_DIR}/tools/geos_svn_revision_cmake.h.in"
+ "${PROJECT_SOURCE_DIR}/geos_svn_revision.h" )
+ # "${geos_BINARY_DIR}/include/geos_svn_revision.h" )
+else()
+ message(STATUS "Generating revision header ${CMAKE_SOURCE_DIR}/geos_svn_revision.h")
+ find_program(SH sh)
+ if(SH)
+ execute_process(COMMAND ${SH} -c
+ "cd ${CMAKE_SOURCE_DIR} && ${CMAKE_SOURCE_DIR}/tools/svn_repo_revision.sh")
- file(RENAME "${CMAKE_SOURCE_DIR}/geos_svn_revision.h"
- "${CMAKE_BINARY_DIR}/geos_svn_revision.h")
-else()
- message("*** sh-compatible command not found, cannot create geos_svn_revision.h")
- message("*** Check SVN revision and create revision header manually:")
- message("*** echo '#define GEOS_SVN_REVISION XYZ' > ${CMAKE_SOURCE_DIR}/geos_svn_revision.h")
+ file(RENAME "${CMAKE_SOURCE_DIR}/geos_svn_revision.h"
+ "${CMAKE_BINARY_DIR}/geos_svn_revision.h")
+ else()
+ message("*** sh-compatible command not found, cannot create geos_svn_revision.h")
+ message("*** Check SVN revision and create revision header manually:")
+ message("*** echo '#define GEOS_SVN_REVISION XYZ' > ${CMAKE_SOURCE_DIR}/geos_svn_revision.h")
+ endif()
endif()
+# End: Determine SVN/Git revision
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include/geos/platform.h)
message(STATUS "Disabling existing ${CMAKE_CURRENT_SOURCE_DIR}/include/geos/platform.h")
Added: trunk/tools/geos_svn_revision_cmake.h.in
===================================================================
--- trunk/tools/geos_svn_revision_cmake.h.in (rev 0)
+++ trunk/tools/geos_svn_revision_cmake.h.in 2013-08-03 15:37:46 UTC (rev 3861)
@@ -0,0 +1 @@
+#define GEOS_SVN_REVISION @GEOS_SVN_REVISION@
More information about the geos-commits
mailing list