Browse Source

Some small improvements

master
Bergmann89 2 years ago
parent
commit
f1ff5b9d65
2 changed files with 15 additions and 15 deletions
  1. +1
    -1
      cmake/FindGTest.cmake
  2. +14
    -14
      cmake/git_helper.cmake

+ 1
- 1
cmake/FindGTest.cmake View File

@@ -31,7 +31,7 @@ If( CMAKE_CROSSCOMPILING )
EndIf ( )

If( GTest_FOUND )
Message ( FATAL_ERROR "GTest already found! Do not expect that an other CMake script looked for 'GTest'. " )
Return ()
EndIf ( )

# Configure external project


+ 14
- 14
cmake/git_helper.cmake View File

@@ -29,18 +29,29 @@ Function ( GitGetVersion GIT_ROOT OUT_MAJOR OUT_MINOR OUT_PATCH OUT_BUILD OUT_HA
Message ( FATAL_ERROR "${GIT_ROOT} is not a git directory" )
EndIf ( )

# Find the latest git tag
GitExecute ( "${GIT_ROOT}" "git describe --tags --abbrev=1 --match v[0-9].[0-9]* HEAD" False TAG SUCCESS )
# Hash
GitExecute ( "${GIT_ROOT}" "git rev-parse HEAD" True HASH SUCCESS )
If ( NOT ${SUCCESS} )
Return ( )
EndIf ( )

String ( STRIP "${HASH}" HASH )
Set ( ${OUT_HASH} ${HASH} PARENT_SCOPE )

# Dirty
GitExecute ( "${GIT_ROOT}" "git status -s -uall" True DIRTY SUCCESS )
If ( NOT ${SUCCESS} )
Return ( )
EndIf ( )

GitExecute ( "${GIT_ROOT}" "git rev-parse HEAD" True HASH SUCCESS )
If ( DIRTY )
Set ( ${OUT_DIRTY} 1 PARENT_SCOPE )
Else ( )
Set ( ${OUT_DIRTY} 0 PARENT_SCOPE )
EndIf ( )

# Version
GitExecute ( "${GIT_ROOT}" "git describe --tags --abbrev=1 --match v[0-9].[0-9]* HEAD" False TAG SUCCESS )
If ( NOT ${SUCCESS} )
Return ( )
EndIf ( )
@@ -87,20 +98,9 @@ Function ( GitGetVersion GIT_ROOT OUT_MAJOR OUT_MINOR OUT_PATCH OUT_BUILD OUT_HA
Set ( ${OUT_BUILD} ${TMP} PARENT_SCOPE )
EndIf ( )

# hash
String ( STRIP "${HASH}" HASH )
Set ( ${OUT_HASH} ${HASH} PARENT_SCOPE )

# behind
Set ( ${OUT_BEHIND} ${BEHIND} PARENT_SCOPE )

# dirty
If ( DIRTY )
Set ( ${OUT_DIRTY} 1 PARENT_SCOPE )
Else ( )
Set ( ${OUT_DIRTY} 0 PARENT_SCOPE )
EndIf ( )

EndFunction ( )

# Get the git hash og the current commit


Loading…
Cancel
Save