diff options
author | Riccardo Spagni <ric@spagni.net> | 2014-09-12 13:18:12 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2014-09-12 13:18:12 +0200 |
commit | e7c52d94c07f7b66ef428c764bb920e221a05048 (patch) | |
tree | 6e8c9e684e67dc0e840df991bde4640c3f76f87b /src/version.cmake | |
parent | Merge pull request #129 from Jebes/master (diff) | |
parent | Merge branch 'master' of http://github.com/fluffypony/bitmonero (diff) | |
download | monero-e7c52d94c07f7b66ef428c764bb920e221a05048.tar.xz |
Merge pull request #132 from fluffypony/master
versioning now includes the commit hash, or -final for tagged releases
Diffstat (limited to 'src/version.cmake')
-rw-r--r-- | src/version.cmake | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/version.cmake b/src/version.cmake index 880224dc6..40243c018 100644 --- a/src/version.cmake +++ b/src/version.cmake @@ -1,11 +1,25 @@ -execute_process(COMMAND "${GIT}" describe --dirty --match "v${VERSION}" RESULT_VARIABLE RET OUTPUT_VARIABLE DESCRIPTION OUTPUT_STRIP_TRAILING_WHITESPACE) +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 revision. Make sure that you are building either from a Git working tree or from a source archive.") - set(VERSION "${COMMIT}") + 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() - string(REGEX MATCH "([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f])?(-dirty)? $" COMMIT "${DESCRIPTION} ") - string(STRIP "${COMMIT}" COMMIT) - set(VERSION "${COMMIT}") + 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) + 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()
\ No newline at end of file |