diff options
author | Patrick Valsecchi <patrick@thus.ch> | 2015-02-03 08:56:55 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-02-03 07:17:18 -0800 |
commit | 6e5b0ee6dbb194f38bedf90dccba84e37e3380c7 (patch) | |
tree | 89081ccbc6a8ec56e2665fbc890d5fa2413a6e18 /CMakeLists.txt | |
parent | 834b1e5b4d056b0221391e43e849652b3904f009 (diff) | |
download | subsurface-6e5b0ee6dbb194f38bedf90dccba84e37e3380c7.tar.gz |
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>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c9e32a35f..8c8cad1bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,13 +55,38 @@ 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 - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - CONFIGURE_FILE(\${SRC} \${DST} @ONLY) +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) ") ADD_CUSTOM_TARGET(version ALL COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_BINARY_DIR}/version.h.in |