CMake: handle OwlPS' version
This commit is contained in:
parent
7598bc9451
commit
77fcc23026
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue