Fix git commit tracking
This commit is contained in:
parent
90842c23a2
commit
a83ef111c8
@ -19,8 +19,16 @@ set (project_version "0.9.2")
|
||||
# we could also detect dirty worktrees but that's very hard to get right.
|
||||
find_package (Git)
|
||||
set (git_head "${PROJECT_SOURCE_DIR}/.git/HEAD")
|
||||
if (GIT_FOUND AND EXISTS ${git_head})
|
||||
configure_file (${git_head} git-head.tag COPYONLY)
|
||||
if (GIT_FOUND AND EXISTS "${git_head}")
|
||||
configure_file ("${git_head}" git-head.tag COPYONLY)
|
||||
file (READ "${git_head}" git_head_content)
|
||||
if (git_head_content MATCHES "^ref: ([^\r\n]+)")
|
||||
set (git_ref "${PROJECT_SOURCE_DIR}/.git/${CMAKE_MATCH_1}")
|
||||
if (EXISTS "${git_ref}")
|
||||
configure_file ("${git_ref}" git-ref.tag COPYONLY)
|
||||
endif (EXISTS "${git_ref}")
|
||||
endif (git_head_content MATCHES "^ref: ([^\r\n]+)")
|
||||
|
||||
execute_process (COMMAND ${GIT_EXECUTABLE} describe --tags --match v*
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
RESULT_VARIABLE git_describe_result
|
||||
@ -28,7 +36,7 @@ if (GIT_FOUND AND EXISTS ${git_head})
|
||||
if (NOT git_describe_result)
|
||||
string (REGEX REPLACE "^v" "" project_version "${git_describe}")
|
||||
endif (NOT git_describe_result)
|
||||
endif (GIT_FOUND AND EXISTS ${git_head})
|
||||
endif (GIT_FOUND AND EXISTS "${git_head}")
|
||||
|
||||
# Dashes make filenames confusing and upset packaging software
|
||||
string (REPLACE "-" "+" project_version_safe "${project_version}")
|
||||
|
Loading…
Reference in New Issue
Block a user