Sfoglia il codice sorgente

* Added git helper to get commit hash only

master
Klaus Nöske 6 anni fa
parent
commit
e59928a3a9
1 ha cambiato i file con 18 aggiunte e 0 eliminazioni
  1. +18
    -0
      cmake/git_helper.cmake

+ 18
- 0
cmake/git_helper.cmake Vedi File

@@ -100,3 +100,21 @@ Function ( GitGetVersion GIT_ROOT OUT_MAJOR OUT_MINOR OUT_PATCH OUT_BUILD OUT_HA
EndIf ( )

EndFunction ( )

# Get the git hash og the current commit
Function ( GitGetHash GIT_ROOT OUT_HASH )

If ( NOT EXISTS "${GIT_ROOT}/.git" )
Return ( )
EndIf ( )

GitExecute ( "git -C ${CMAKE_CURRENT_SOURCE_DIR} rev-parse HEAD" True HASH SUCCESS )
If ( NOT ${SUCCESS} )
Return ( )
EndIf ( )

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

EndFunction ( )

Caricamento…
Annulla
Salva