fix(cmake): properly exclude prereleases when fetching latest tag from cmake.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
This commit is contained in:
Federico Di Pierro 2023-05-16 15:12:08 +02:00 committed by poiana
parent 577bccabd0
commit 9c483adafa

View File

@ -91,15 +91,16 @@ function(git_get_latest_tag _var)
find_package(Git QUIET)
endif()
# We use git describe --tags `git rev-list --tags --max-count=1`
# We use git describe --tags `git rev-list --exclude "*.*.*-*" --tags --max-count=1`
# Note how we eclude prereleases tags (the ones with "-alphaX")
execute_process(COMMAND
"${GIT_EXECUTABLE}"
rev-list
--exclude "*.*.*-*"
--tags
--max-count=1
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}"
COMMAND tail -n1
RESULT_VARIABLE
res
OUTPUT_VARIABLE