2014-09-12 05:06:51 -06:00
|
|
|
execute_process(COMMAND "${GIT}" rev-parse --short HEAD RESULT_VARIABLE RET OUTPUT_VARIABLE COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
|
2014-03-03 15:07:58 -07:00
|
|
|
if(RET)
|
2014-09-12 05:06:51 -06:00
|
|
|
message(WARNING "Cannot determine current commit. Make sure that you are building either from a Git working tree or from a source archive.")
|
|
|
|
set(VERSIONTAG "unknown")
|
2014-03-03 15:07:58 -07:00
|
|
|
configure_file("src/version.h.in" "${TO}")
|
|
|
|
else()
|
2014-09-12 05:06:51 -06:00
|
|
|
message(STATUS "You are currently on commit ${COMMIT}")
|
|
|
|
execute_process(COMMAND "${GIT}" show-ref --tags -d --abbrev COMMAND awk "END{print $1}" RESULT_VARIABLE RET OUTPUT_VARIABLE TAGGEDCOMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)
|
2014-09-15 00:22:52 -06:00
|
|
|
if(RET AND NOT TAGGEDCOMMIT)
|
2014-09-12 05:06:51 -06:00
|
|
|
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()
|
|
|
|
message(STATUS "The most recent tag was at ${TAGGEDCOMMIT}")
|
2014-09-12 05:27:30 -06:00
|
|
|
if(${COMMIT} MATCHES ${TAGGEDCOMMIT})
|
2014-09-12 05:06:51 -06:00
|
|
|
message(STATUS "You are building a tagged release")
|
|
|
|
set(VERSIONTAG "release")
|
|
|
|
else()
|
|
|
|
message(STATUS "You are ahead or behind of a tagged release")
|
|
|
|
set(VERSIONTAG "${COMMIT}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2014-03-03 15:07:58 -07:00
|
|
|
configure_file("src/version.h.in" "${TO}")
|
|
|
|
endif()
|