Skip to content

Commit

Permalink
improve qgssvnversion.h creation
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11451 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Aug 20, 2009
1 parent 3bd3e06 commit a42e27f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 32 deletions.
41 changes: 27 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -340,20 +340,33 @@ LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/src/core ${CMAKE_BINARY_DIR}/src/gui)

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)

ADD_CUSTOM_COMMAND (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qgssvnversion.h
DEPENDS ${SVN_MARKER}
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/svnscript.cmake
)
IF (SVN_MARKER)
# See if we have svn installed
FIND_PROGRAM(SVNVERSION svnversion PATHS c:/cygwin/bin)

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)

Expand Down
1 change: 0 additions & 1 deletion cmake_templates/qgssvnversion.h.in_cmake

This file was deleted.

17 changes: 0 additions & 17 deletions cmake_templates/svnscript.cmake.in_cmake

This file was deleted.

3 changes: 3 additions & 0 deletions ms-windows/osgeo4w/package.cmd
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -99,6 +100,8 @@ cmake -G "Visual Studio 9 2008" ^
-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

Expand Down

0 comments on commit a42e27f

Please sign in to comment.