Fix getting the latest tag distance. #126

This commit is contained in:
Roman Telezhynskyi 2021-05-13 21:38:24 +03:00
parent 1ea8e1baaa
commit 5c8fbbcc59
2 changed files with 4 additions and 4 deletions

View File

@ -292,7 +292,7 @@ defineReplace(FindBuildRevision){
defineReplace(FindLatestTagDistance){ defineReplace(FindLatestTagDistance){
CONFIG(debug, debug|release){ CONFIG(debug, debug|release){
# Debug mode # Debug mode
return(\\\"0\\\") return(0)
}else{ }else{
# Release mode # Release mode
@ -302,10 +302,10 @@ defineReplace(FindLatestTagDistance){
# 3. latest commit is gSHA # 3. latest commit is gSHA
tag_all = $$system(git describe --tags) tag_all = $$system(git describe --tags)
tag_split = $$split(tag_all, "-") #split at the dashes tag_split = $$split(tag_all, "-") #split at the dashes
GIT_DISTANCE = \\\"$$member(tag_split,1)\\\" #get 2nd element of results GIT_DISTANCE = $$member(tag_split,1) #get 2nd element of results
isEmpty(GIT_DISTANCE){ isEmpty(GIT_DISTANCE){
GIT_DISTANCE = \\\"0\\\" # if we can't find local revision left 0. GIT_DISTANCE = 0 # if we can't find local revision left 0.
} }
message("Latest tag distance:" $${GIT_DISTANCE}) message("Latest tag distance:" $${GIT_DISTANCE})

View File

@ -90,6 +90,6 @@ CONFIG(debug, debug|release){
} }
} }
DEFINES += "LATEST_TAG_DISTANCE=$$FindLatestTagDistance()" # Make available latest tag distance number in sources. DEFINES += LATEST_TAG_DISTANCE=\\\"$$FindLatestTagDistance()\\\" # Make available latest tag distance number in sources.
include (../libs.pri) include (../libs.pri)