diff options
author | bunnei <ericbunnie@gmail.com> | 2014-04-24 04:13:00 +0200 |
---|---|---|
committer | bunnei <ericbunnie@gmail.com> | 2014-04-24 04:13:00 +0200 |
commit | 80a040ac772132a8d8e7385c0261f545adc88aee (patch) | |
tree | 682a57288e9f1fdde230b075e5ab354adc1b2c07 /externals/cmake-modules/GetGitRevisionDescription.cmake | |
parent | updated windows scm_rev code to use new style (diff) | |
download | yuzu-80a040ac772132a8d8e7385c0261f545adc88aee.tar yuzu-80a040ac772132a8d8e7385c0261f545adc88aee.tar.gz yuzu-80a040ac772132a8d8e7385c0261f545adc88aee.tar.bz2 yuzu-80a040ac772132a8d8e7385c0261f545adc88aee.tar.lz yuzu-80a040ac772132a8d8e7385c0261f545adc88aee.tar.xz yuzu-80a040ac772132a8d8e7385c0261f545adc88aee.tar.zst yuzu-80a040ac772132a8d8e7385c0261f545adc88aee.zip |
Diffstat (limited to '')
-rw-r--r-- | externals/cmake-modules/GetGitRevisionDescription.cmake | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/externals/cmake-modules/GetGitRevisionDescription.cmake b/externals/cmake-modules/GetGitRevisionDescription.cmake index 2b9cde061..087f5deea 100644 --- a/externals/cmake-modules/GetGitRevisionDescription.cmake +++ b/externals/cmake-modules/GetGitRevisionDescription.cmake @@ -80,6 +80,34 @@ function(get_git_head_revision _refspecvar _hashvar) set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) endfunction() +function(git_branch_name _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + + if(NOT GIT_FOUND) + set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) + return() + endif() + + execute_process(COMMAND + "${GIT_EXECUTABLE}" + rev-parse --abbrev-ref HEAD + WORKING_DIRECTORY + "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE + res + OUTPUT_VARIABLE + out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT res EQUAL 0) + set(out "${out}-${res}-NOTFOUND") + endif() + + set(${_var} "${out}" PARENT_SCOPE) +endfunction() + function(git_describe _var) if(NOT GIT_FOUND) find_package(Git QUIET) |