aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2020-12-09 19:03:29 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2020-12-10 19:12:41 +0000
commit45d9a282d1aeb571117aad3c682e8bab8e4c6779 (patch)
tree40da208f9353eddfe735962b300b006b0ecb1085
parentMerge pull request #7010 (diff)
downloadmonero-45d9a282d1aeb571117aad3c682e8bab8e4c6779.tar.xz
cmake: fix "release" version string on tagged releases
It would not say "release" if we're on a previous tag
-rw-r--r--cmake/GitVersion.cmake26
1 files changed, 9 insertions, 17 deletions
diff --git a/cmake/GitVersion.cmake b/cmake/GitVersion.cmake
index 3263266c7..6a62bcaa3 100644
--- a/cmake/GitVersion.cmake
+++ b/cmake/GitVersion.cmake
@@ -48,29 +48,21 @@ function (get_version_tag_from_git GIT)
message(STATUS "You are currently on commit ${COMMIT}")
# Get all the tags
- execute_process(COMMAND "${GIT}" rev-list --tags --max-count=1 --abbrev-commit
+ execute_process(COMMAND "${GIT}" tag -l --points-at HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE RET
- OUTPUT_VARIABLE TAGGEDCOMMIT
+ OUTPUT_VARIABLE TAG
OUTPUT_STRIP_TRAILING_WHITESPACE)
- 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.")
+ # Check if we're building that tagged commit or a different one
+ if(TAG)
+ message(STATUS "You are building a tagged release")
+ set(VERSIONTAG "release")
+ set(VERSION_IS_RELEASE "true")
+ else()
+ message(STATUS "You are ahead of or behind a tagged release")
set(VERSIONTAG "${COMMIT}")
set(VERSION_IS_RELEASE "false")
- else()
- message(STATUS "The most recent tag was at ${TAGGEDCOMMIT}")
-
- # Check if we're building that tagged commit or a different one
- if(COMMIT STREQUAL TAGGEDCOMMIT)
- message(STATUS "You are building a tagged release")
- set(VERSIONTAG "release")
- set(VERSION_IS_RELEASE "true")
- else()
- message(STATUS "You are ahead of or behind a tagged release")
- set(VERSIONTAG "${COMMIT}")
- set(VERSION_IS_RELEASE "false")
- endif()
endif()
endif()