Permalink
Browse files

Allow to override version string with cmake parameter

  • Loading branch information...
milot-mirdita committed Jan 3, 2018
1 parent 593212e commit f7991db39493116634c26c1cb0a4340287f85d0a
Showing with 10 additions and 4 deletions.
  1. +1 −0 CMakeLists.txt
  2. +9 −4 src/version/CMakeLists.txt
View
@@ -6,6 +6,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(FRAMEWORK_ONLY 0 CACHE BOOL "Framework Mode")
set(HAVE_SANITIZER 0 CACHE BOOL "Have Sanitizers")
set(VERSION_OVERRIDE "" CACHE STRNG "Override version string in help and usage messages")
#Sanitizers
if (${HAVE_SANITIZER})
View
@@ -1,5 +1,10 @@
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
add_library(version Version.cpp)
target_compile_definitions(version PRIVATE -DGIT_SHA1=${GIT_SHA1})
if (VERSION_OVERRIDE)
target_compile_definitions(version PRIVATE -DGIT_SHA1=${VERSION_OVERRIDE})
else()
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
target_compile_definitions(version PRIVATE -DGIT_SHA1=${GIT_SHA1})
endif()

0 comments on commit f7991db

Please sign in to comment.