fixed tag detector
This commit is contained in:
parent
c2faab5e1a
commit
56ff099956
1 changed files with 16 additions and 36 deletions
|
@ -41,25 +41,7 @@ else()
|
||||||
message(STATUS "You are currently on commit ${COMMIT}")
|
message(STATUS "You are currently on commit ${COMMIT}")
|
||||||
|
|
||||||
# Get all the tags
|
# Get all the tags
|
||||||
execute_process(COMMAND "${GIT}" show-ref --tags -d --abbrev RESULT_VARIABLE RET OUTPUT_VARIABLE TAGGEDCOMMITOUT OUTPUT_STRIP_TRAILING_WHITESPACE)
|
execute_process(COMMAND "${GIT}" rev-list --tags --max-count=1 --abbrev-commit RESULT_VARIABLE RET OUTPUT_VARIABLE TAGGEDCOMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
# Make sure we actually got some tags
|
|
||||||
if(TAGGEDCOMMITOUT)
|
|
||||||
string(LENGTH ${TAGGEDCOMMITOUT} TLEN)
|
|
||||||
else()
|
|
||||||
set(TLEN 1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(RET OR TLEN LESS 5)
|
|
||||||
message(WARNING "Cannot determine most recent tag. Make sure that you are building either from a Git working tree or from a source archive.")
|
|
||||||
set(VERSIONTAG "${COMMIT}")
|
|
||||||
else()
|
|
||||||
# Replace a bunch of things so we end up with a semi-colon separated list
|
|
||||||
string(REPLACE " refs/" "\n" TAGGEDCOMMITOUT2 ${TAGGEDCOMMITOUT})
|
|
||||||
string(REPLACE "\n" ";" TAGGEDCOMMITLIST ${TAGGEDCOMMITOUT2})
|
|
||||||
|
|
||||||
# Grab the second-last item in the list, as that will be the hash of our most recent commit
|
|
||||||
list(GET TAGGEDCOMMITLIST -2 TAGGEDCOMMIT)
|
|
||||||
|
|
||||||
if(NOT TAGGEDCOMMIT)
|
if(NOT TAGGEDCOMMIT)
|
||||||
message(WARNING "Cannot determine most recent tag. Make sure that you are building either from a Git working tree or from a source archive.")
|
message(WARNING "Cannot determine most recent tag. Make sure that you are building either from a Git working tree or from a source archive.")
|
||||||
|
@ -77,7 +59,5 @@ else()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
|
||||||
|
|
||||||
configure_file("src/version.h.in" "${TO}")
|
configure_file("src/version.h.in" "${TO}")
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in a new issue