Merge pull request #7115

45d9a282d cmake: fix "release" version string on tagged releases (moneromooo-monero)
This commit is contained in:
Alexander Blair 2020-12-10 17:56:15 -08:00
commit 91f941120d
No known key found for this signature in database
GPG Key ID: C64552D877C32479
1 changed files with 9 additions and 17 deletions

View File

@ -48,21 +48,14 @@ function (get_version_tag_from_git GIT)
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}" rev-list --tags --max-count=1 --abbrev-commit execute_process(COMMAND "${GIT}" tag -l --points-at HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE RET RESULT_VARIABLE RET
OUTPUT_VARIABLE TAGGEDCOMMIT OUTPUT_VARIABLE TAG
OUTPUT_STRIP_TRAILING_WHITESPACE) 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.")
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 # Check if we're building that tagged commit or a different one
if(COMMIT STREQUAL TAGGEDCOMMIT) if(TAG)
message(STATUS "You are building a tagged release") message(STATUS "You are building a tagged release")
set(VERSIONTAG "release") set(VERSIONTAG "release")
set(VERSION_IS_RELEASE "true") set(VERSION_IS_RELEASE "true")
@ -72,7 +65,6 @@ function (get_version_tag_from_git GIT)
set(VERSION_IS_RELEASE "false") set(VERSION_IS_RELEASE "false")
endif() endif()
endif() endif()
endif()
set(VERSIONTAG "${VERSIONTAG}" PARENT_SCOPE) set(VERSIONTAG "${VERSIONTAG}" PARENT_SCOPE)
set(VERSION_IS_RELEASE "${VERSION_IS_RELEASE}" PARENT_SCOPE) set(VERSION_IS_RELEASE "${VERSION_IS_RELEASE}" PARENT_SCOPE)