CMake: handle OwlPS' version

This commit is contained in:
Matteo Cypriani 2013-05-18 20:36:01 -04:00 committed by Matteo Cypriani
parent 7598bc9451
commit 77fcc23026
2 changed files with 22 additions and 1 deletions

View File

@ -14,6 +14,28 @@ set(GENERATED_INCLUDE "${PROJECT_BINARY_DIR}/include")
include_directories("${GENERATED_INCLUDE}")
### OwlPS' version ###
# First, try to get it from the environment variable OWLPS_VERSION
if (NOT "$ENV{OWLPS_VERSION}" STREQUAL "")
add_definitions(-DOWLPS_VERSION="$ENV{OWLPS_VERSION}")
# Environment variable OWLPS_VERSION not set: try to get the version
# number from git describe
else()
execute_process(
COMMAND git describe
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE RET
OUTPUT_VARIABLE OWLPS_VERSION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (${RET} EQUAL 0)
add_definitions(-DOWLPS_VERSION="${OWLPS_VERSION}")
endif()
endif()
### Options ###
option (DEBUG

View File

@ -56,7 +56,6 @@ Work to do in OwlPS
- Add option dump-configuration (displays the config & exits).
- CMake:
- handle OwlPS version
- libraries: version numbers (sonames) and symbolic links
- compilation flags
- installation targets