diff --git a/cmake/git_helper.cmake b/cmake/git_helper.cmake index 8809ed3..c731852 100644 --- a/cmake/git_helper.cmake +++ b/cmake/git_helper.cmake @@ -24,21 +24,21 @@ EndFunction ( ) Function ( GitGetVersion GIT_ROOT OUT_MAJOR OUT_MINOR OUT_PATCH OUT_BUILD OUT_HASH OUT_BEHIND OUT_DIRTY ) If ( NOT EXISTS "${GIT_ROOT}/.git" ) - Return ( ) + Message ( FATAL_ERROR "${GIT_ROOT} is not a git directory" ) EndIf ( ) # Find the latest git tag - GitExecute ( "git -C ${CMAKE_CURRENT_SOURCE_DIR} describe --tags --abbrev=1 --match v[0-9].[0-9]* HEAD" False TAG SUCCESS ) + GitExecute ( "git -C ${GIT_ROOT} describe --tags --abbrev=1 --match v[0-9].[0-9]* HEAD" False TAG SUCCESS ) If ( NOT ${SUCCESS} ) Return ( ) EndIf ( ) - GitExecute ( "git -C ${CMAKE_CURRENT_SOURCE_DIR} status -s -uall" True DIRTY SUCCESS ) + GitExecute ( "git -C ${GIT_ROOT} status -s -uall" True DIRTY SUCCESS ) If ( NOT ${SUCCESS} ) Return ( ) EndIf ( ) - GitExecute ( "git -C ${CMAKE_CURRENT_SOURCE_DIR} rev-parse HEAD" True HASH SUCCESS ) + GitExecute ( "git -C ${GIT_ROOT} rev-parse HEAD" True HASH SUCCESS ) If ( NOT ${SUCCESS} ) Return ( ) EndIf ( ) @@ -105,10 +105,10 @@ EndFunction ( ) Function ( GitGetHash GIT_ROOT OUT_HASH ) If ( NOT EXISTS "${GIT_ROOT}/.git" ) - Return ( ) + Message ( FATAL_ERROR "${GIT_ROOT} is not a git directory" ) EndIf ( ) - GitExecute ( "git -C ${CMAKE_CURRENT_SOURCE_DIR} rev-parse HEAD" True HASH SUCCESS ) + GitExecute ( "git -C ${GIT_ROOT} rev-parse HEAD" True HASH SUCCESS ) If ( NOT ${SUCCESS} ) Return ( ) EndIf ( ) @@ -123,10 +123,10 @@ EndFunction ( ) Function ( GitGetIsDirty GIT_ROOT OUT_DIRTY ) If ( NOT EXISTS "${GIT_ROOT}/.git" ) - Return ( ) + Message ( FATAL_ERROR "${GIT_ROOT} is not a git directory" ) EndIf ( ) - GitExecute ( "git -C ${CMAKE_CURRENT_SOURCE_DIR} status -s -uall" True DIRTY SUCCESS ) + GitExecute ( "git -C ${GIT_ROOT} status -s -uall" True DIRTY SUCCESS ) If ( NOT ${SUCCESS} ) Return ( ) EndIf ( )