mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Allow external overriding of auto-fetched git hash identifier in cmake
* This is useful if the build doesn't happen within a git checkout and you want to pass in the hash anyway, but it also allows adding suffixes like -official etc.
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user