From 9c483adafa2666b0fcf3516c0507cb211ee88a7f Mon Sep 17 00:00:00 2001 From: Federico Di Pierro Date: Tue, 16 May 2023 15:12:08 +0200 Subject: [PATCH] fix(cmake): properly exclude prereleases when fetching latest tag from cmake. Signed-off-by: Federico Di Pierro --- cmake/modules/GetGitRevisionDescription.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/modules/GetGitRevisionDescription.cmake b/cmake/modules/GetGitRevisionDescription.cmake index 4e7a2739..99a74450 100644 --- a/cmake/modules/GetGitRevisionDescription.cmake +++ b/cmake/modules/GetGitRevisionDescription.cmake @@ -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