Commit 0a564b6e authored by Christophe Geuzaine's avatar Christophe Geuzaine

better git detection

parent 8b486d94
Pipeline #2000 passed with stage
in 29 minutes 57 seconds
......@@ -69,10 +69,17 @@ set(GETDP_PATCH_VERSION 4)
set(GETDP_EXTRA_VERSION "")
if(NOT GETDP_RELEASE)
execute_process(COMMAND git log -1 --format=%h WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE)
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif(GIT_FOUND)
if(GIT_COMMIT_HASH)
set(GETDP_EXTRA_VERSION "-git-${GIT_COMMIT_HASH}")
else(GIT_COMMIT_HASH)
set(GETDP_EXTRA_VERSION "-git")
endif(GIT_COMMIT_HASH)
endif(NOT GETDP_RELEASE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment