llvm.org GIT mirror llvm / 59d5145
When building from git, add ref-id to PACKAGE_VERSION git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110301 91177308-0d34-0410-b5e6-96231b3b80d8 Oscar Fuentes 9 years ago
1 changed file(s) with 13 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
1414 endif()
1515 elseif( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git )
1616 set(result "${result}git")
17 # Try to get a ref-id
18 find_program(git_executable NAMES git git.exe git.cmd)
19 if( git_executable )
20 execute_process(COMMAND ${git_executable} show-ref HEAD
21 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
22 TIMEOUT 5
23 RESULT_VARIABLE git_result
24 OUTPUT_VARIABLE git_output)
25 if( git_result EQUAL 0 )
26 string(SUBSTRING ${git_output} 0 7 git_ref_id)
27 set(result "${result}-${git_ref_id}")
28 endif()
29 endif()
1730 endif()
1831 set(${VERS} ${result} PARENT_SCOPE)
1932 endfunction(add_version_info_from_vcs)