diff --git a/CMakeLists.txt b/CMakeLists.txt index d030c17..426b49e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/TODO.t2t b/TODO.t2t index 565b55b..f3d0cfb 100644 --- a/TODO.t2t +++ b/TODO.t2t @@ -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