blob: 9005d65dbcb90677b2ce623053442b038768d899 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
function(git_rev_parse VAR)
execute_process(
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE PARSE_RESULT
OUTPUT_VARIABLE PARSE_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT PARSE_RESULT)
set(${VAR} ${PARSE_OUTPUT} PARENT_SCOPE)
else()
set(${VAR} "Unknown" PARENT_SCOPE)
endif()
endfunction()
|