소스 검색

* Added git helper to get commit hash only

master
Klaus Nöske 6 년 전
부모
커밋
e59928a3a9
1개의 변경된 파일18개의 추가작업 그리고 0개의 파일을 삭제
  1. +18
    -0
      cmake/git_helper.cmake

+ 18
- 0
cmake/git_helper.cmake 파일 보기

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

불러오는 중...
취소
저장