Check the process exit code rather than output variable for git header creation

This commit is contained in:
Mark Roszko 2022-10-29 18:39:02 +00:00
parent 39b9b3e570
commit 08452433e8
1 changed files with 6 additions and 6 deletions

View File

@ -38,8 +38,8 @@ macro( create_git_version_header _git_src_path )
${GIT_EXECUTABLE} describe --dirty
WORKING_DIRECTORY ${_git_src_path}
OUTPUT_VARIABLE _git_DESCRIBE
ERROR_VARIABLE _git_log_error
RESULT_VARIABLE _git_log_result
ERROR_VARIABLE _git_describe_error
RESULT_VARIABLE _git_describe_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
@ -47,8 +47,8 @@ macro( create_git_version_header _git_src_path )
${GIT_EXECUTABLE} rev-list --count --first-parent HEAD
WORKING_DIRECTORY ${_git_src_path}
OUTPUT_VARIABLE _git_REV_COUNT
ERROR_VARIABLE _git_log_error
RESULT_VARIABLE _git_log_result
ERROR_VARIABLE _git_rev_count_error
RESULT_VARIABLE _git_rev_count_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
set( ENV{LC_ALL} ${_Git_SAVED_LC_ALL} )
@ -56,11 +56,11 @@ macro( create_git_version_header _git_src_path )
# Check to make sure 'git' command did not fail. Otherwise fallback
# to KiCadVersion.cmake as the revision level.
if( _git_DESCRIBE )
if( _git_describe_result EQUAL 0 )
set( KICAD_VERSION "(${_git_DESCRIBE})" )
endif()
if( _git_REV_COUNT )
if( _git_rev_count_result EQUAL 0 )
set( KICAD_GIT_REV "${_git_REV_COUNT}" )
# Sanity check