[QGIS Commit] r11451 - in trunk/qgis: . cmake_templates ms-windows/osgeo4w

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Aug 20 11:31:45 EDT 2009


Author: jef
Date: 2009-08-20 11:31:45 -0400 (Thu, 20 Aug 2009)
New Revision: 11451

Removed:
   trunk/qgis/cmake_templates/qgssvnversion.h.in_cmake
   trunk/qgis/cmake_templates/svnscript.cmake.in_cmake
Modified:
   trunk/qgis/CMakeLists.txt
   trunk/qgis/ms-windows/osgeo4w/package.cmd
Log:
improve qgssvnversion.h creation

Modified: trunk/qgis/CMakeLists.txt
===================================================================
--- trunk/qgis/CMakeLists.txt	2009-08-20 10:04:10 UTC (rev 11450)
+++ trunk/qgis/CMakeLists.txt	2009-08-20 15:31:45 UTC (rev 11451)
@@ -340,20 +340,33 @@
 
 FIND_FILE(SVN_MARKER entries PATHS ${CMAKE_SOURCE_DIR}/.svn)
 
-IF (NOT SVN_MARKER)
-  SET (SVN_MARKER ${CMAKE_SOURCE_DIR}/CMakeLists.txt)  # Dummy file
-ENDIF (NOT SVN_MARKER)
-  # Add a custom command to drive the svn script whenever the svn entries
-  # file changes.
-  CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake_templates/svnscript.cmake.in_cmake
-                ${CMAKE_CURRENT_BINARY_DIR}/svnscript.cmake
-                @ONLY)
+IF (SVN_MARKER)
+  # See if we have svn installed
+  FIND_PROGRAM(SVNVERSION svnversion PATHS c:/cygwin/bin)
 
-  ADD_CUSTOM_COMMAND (
-    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qgssvnversion.h
-    DEPENDS ${SVN_MARKER}
-    COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/svnscript.cmake
-)
+  IF(SVNVERSION)
+    IF(MSVC)
+	ADD_CUSTOM_COMMAND(
+		OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qgssvnversion.h
+		COMMAND for /f usebackq %%a in "(`${SVNVERSION}`)" do echo \#define QGSSVNVERSION \"%%a\" >${CMAKE_CURRENT_BINARY_DIR}/qgssvnversion.h
+		MAIN_DEPENDENCY ${SVN_MARKER}
+		WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+	)
+    ELSE(MSVC)
+	ADD_CUSTOM_COMMAND(
+		OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qgssvnversion.h
+		COMMAND echo \\\#define QGSSVNVERSION \\\"`${SVNVERSION}`\\\" >${CMAKE_CURRENT_BINARY_DIR}/qgssvnversion.h
+		MAIN_DEPENDENCY ${SVN_MARKER}
+		WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+	)
+    ENDIF(MSVC)
+  ELSE(SVNVERSION)
+    MESSAGE(STATUS "svnversion not found - version will be unknown")
+    FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/qgssvnversion.h "#define QGSSVNVERSION \"unknown\"")
+  ENDIF (SVNVERSION)
+ELSE (SVN_MARKER)
+  FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/qgssvnversion.h "#define QGSSVNVERSION \"exported\"")
+ENDIF (SVN_MARKER)
 
 ADD_CUSTOM_TARGET(svnversion ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/qgssvnversion.h)
 

Deleted: trunk/qgis/cmake_templates/qgssvnversion.h.in_cmake
===================================================================
--- trunk/qgis/cmake_templates/qgssvnversion.h.in_cmake	2009-08-20 10:04:10 UTC (rev 11450)
+++ trunk/qgis/cmake_templates/qgssvnversion.h.in_cmake	2009-08-20 15:31:45 UTC (rev 11451)
@@ -1 +0,0 @@
-#define QGSSVNVERSION "@MYVERSION@"

Deleted: trunk/qgis/cmake_templates/svnscript.cmake.in_cmake
===================================================================
--- trunk/qgis/cmake_templates/svnscript.cmake.in_cmake	2009-08-20 10:04:10 UTC (rev 11450)
+++ trunk/qgis/cmake_templates/svnscript.cmake.in_cmake	2009-08-20 15:31:45 UTC (rev 11451)
@@ -1,17 +0,0 @@
-# Magnus Homann svn hack
-# Required?
-SET(CMAKE_BACKWARDS_COMPATIBILITY "2.4")
-
-# See if we have svn installed
-FIND_PROGRAM(SVNVERSION svnversion)
-
-# Read the version if installed, else set to "unknown"
-IF (SVNVERSION)
-        EXEC_PROGRAM(${SVNVERSION} ARGS "@CMAKE_CURRENT_SOURCE_DIR@" OUTPUT_VARIABLE MYVERSION)
-ELSE (SVNVERSION)
-        SET(MYVERSION unknown)
-ENDIF (SVNVERSION)
-
-# Configure the qgssvnversion.h
-CONFIGURE_FILE("@CMAKE_CURRENT_SOURCE_DIR@/cmake_templates/qgssvnversion.h.in_cmake"
-               "@CMAKE_CURRENT_BINARY_DIR@/qgssvnversion.h")

Modified: trunk/qgis/ms-windows/osgeo4w/package.cmd
===================================================================
--- trunk/qgis/ms-windows/osgeo4w/package.cmd	2009-08-20 10:04:10 UTC (rev 11450)
+++ trunk/qgis/ms-windows/osgeo4w/package.cmd	2009-08-20 15:31:45 UTC (rev 11451)
@@ -1,5 +1,6 @@
 @echo off
 set GRASS_VERSION=6.4.0svn
+set SVNVERSION=c:/cygwin/bin/svnversion
 
 set BUILDDIR=%CD%\build
 REM set BUILDDIR=%TEMP%\qgis_unstable
@@ -99,6 +100,8 @@
 	-D QT_ZLIB_LIBRARY=%O4W_ROOT%/lib/zlib.lib ^
 	-D QT_PNG_LIBRARY=%O4W_ROOT%/lib/libpng13.lib ^
 	-D CMAKE_INSTALL_PREFIX=%O4W_ROOT%/apps/qgis-dev ^
+	-D CMAKE_CXX_FLAGS_RELWITHDEBINFO="/MD /ZI /Od /D NDEBUG" ^
+	-D SVNVERSION="%SVNVERSION%" ^
 	%SRCDIR%>>%LOG% 2>&1
 if errorlevel 1 goto error
 



More information about the QGIS-commit mailing list