Fix ssrf-version.h generation by cmake.

My previous cmake patch was relying on ssrf-version.h to be generated
correctly by qmake, in the source directory. This one fixes the generation
of this file in the build directory.

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Patrick Valsecchi 2015-02-03 08:56:55 +01:00 committed by Dirk Hohndel
parent 834b1e5b4d
commit 6e5b0ee6db

View file

@ -55,10 +55,35 @@ FIND_PACKAGE(Marble REQUIRED)
INCLUDE_DIRECTORIES(${MARBLE_INCLUDE_DIR})
# Generate the ssrf-config.h every 'make'
FILE(WRITE ${CMAKE_BINARY_DIR}/version.h.in "\#define VERSION_STRING \"4.1.\"@VERSION@\n")
FILE(WRITE ${CMAKE_BINARY_DIR}/version.cmake "EXECUTE_PROCESS(
COMMAND date +\"%s\"
OUTPUT_VARIABLE VERSION
FILE(WRITE ${CMAKE_BINARY_DIR}/version.h.in "
#define VERSION_STRING \"@VERSION_STRING@\"
#define GIT_VERSION_STRING \"@GIT_VERSION_STRING@\"
#define CANONICAL_VERSION_STRING \"@CANONICAL_VERSION_STRING@\"
")
FILE(WRITE ${CMAKE_BINARY_DIR}/version.cmake "
IF (\${APPLE})
SET(VER_OS darwin)
ELSEIF (\${WIN32})
SET(VER_OS win)
ELSE ()
SET(VER_OS linux)
ENDIF ()
EXECUTE_PROCESS(
COMMAND sh scripts/get-version \${VER_OS}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE VERSION_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE
)
EXECUTE_PROCESS(
COMMAND sh scripts/get-version linux
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_VERSION_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE
)
EXECUTE_PROCESS(
COMMAND sh scripts/get-version full
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE CANONICAL_VERSION_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE
)
CONFIGURE_FILE(\${SRC} \${DST} @ONLY)