diff --git a/CMakeLists.txt b/CMakeLists.txt index bfcd19704..b6eb9c5cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,8 @@ if(CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR) message(FATAL_ERROR "In-source builds not allowed") endif() +set(BUILD_VERSION_HASH "" CACHE STRING "The current git commit hash, possibly with suffixes to indicate build type") + function(get_git_hash _git_hash) if(EXISTS "${CMAKE_SOURCE_DIR}/.git") execute_process( @@ -41,6 +43,9 @@ function(get_git_hash _git_hash) if(NOT GIT_HASH) set(GIT_HASH "NO_GIT_COMMIT_HASH_DEFINED") endif() + if(BUILD_VERSION_HASH) + set(GIT_HASH "${BUILD_VERSION_HASH}") + endif() set(${_git_hash} "${GIT_HASH}" PARENT_SCOPE) endfunction(get_git_hash)