mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 07:52:25 +00:00
3129d51eb4
Signed-off-by: Riccardo Spagni <ric@spagni.net>
25 lines
No EOL
1.2 KiB
CMake
25 lines
No EOL
1.2 KiB
CMake
execute_process(COMMAND "${GIT}" rev-parse --short HEAD RESULT_VARIABLE RET OUTPUT_VARIABLE COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
if(RET)
|
|
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")
|
|
configure_file("src/version.h.in" "${TO}")
|
|
else()
|
|
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)
|
|
if(RET AND 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.")
|
|
set(VERSIONTAG "${COMMIT}")
|
|
else()
|
|
message(STATUS "The most recent tag was at ${TAGGEDCOMMIT}")
|
|
if(${COMMIT} MATCHES ${TAGGEDCOMMIT})
|
|
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()
|
|
|
|
configure_file("src/version.h.in" "${TO}")
|
|
endif() |