Explorar el Código

* Added git helper to get commit hash only

master
Klaus Nöske hace 6 años
padre
commit
e59928a3a9
Se han modificado 1 ficheros con 18 adiciones y 0 borrados
  1. +18
    -0
      cmake/git_helper.cmake

+ 18
- 0
cmake/git_helper.cmake Ver fichero

@@ -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 ( )

Cargando…
Cancelar
Guardar