Created
August 9, 2016 18:09
-
-
Save Marqin/2c34dbcd68195e2ea4819510c6661db9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(get-git-hash _git-hash) | |
if(EXISTS "${CMAKE_SOURCE_DIR}/.git") | |
execute_process( | |
COMMAND git rev-parse HEAD | |
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | |
OUTPUT_VARIABLE GIT_HASH | |
OUTPUT_STRIP_TRAILING_WHITESPACE | |
) | |
else() | |
set(GIT_HASH "NO_GIT_COMMIT_HASH_DEFINED") | |
endif() | |
set(${_git-hash} "${GIT_HASH}" PARENT_SCOPE) | |
endfunction(get-git-hash) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment