Compare commits

...

2 Commits

Author SHA1 Message Date
Federico Di Pierro
4fc6153160 fix(cmake): properly check that git describe returns a real tag (semversioned).
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-02-07 14:36:27 +01:00
Federico Di Pierro
b3f009ad4c fix(cmake): fixed tag fetching fallback (that is indeed needed).
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-02-07 14:36:27 +01:00

View File

@@ -19,6 +19,10 @@ if(NOT FALCO_VERSION)
# Try to obtain the exact git tag # Try to obtain the exact git tag
git_get_exact_tag(FALCO_TAG) git_get_exact_tag(FALCO_TAG)
if(NOT FALCO_TAG) if(NOT FALCO_TAG)
# Obtain the closest tag
git_describe(FALCO_VERSION "--always" "--tags" "--abbrev=7")
string(REGEX MATCH "^[0-9]+.[0-9]+.[0-9]+$" FALCO_TAG ${FALCO_VERSION})
if(FALCO_VERSION MATCHES "NOTFOUND$" OR FALCO_TAG STREQUAL "")
# Fetch current hash # Fetch current hash
get_git_head_revision(refspec FALCO_HASH) get_git_head_revision(refspec FALCO_HASH)
if(NOT FALCO_HASH OR FALCO_HASH MATCHES "NOTFOUND$") if(NOT FALCO_HASH OR FALCO_HASH MATCHES "NOTFOUND$")
@@ -42,6 +46,9 @@ if(NOT FALCO_VERSION)
endif() endif()
endif() endif()
endif() endif()
endif()
# Format FALCO_VERSION to be semver with prerelease and build part
string(REPLACE "-g" "+" FALCO_VERSION "${FALCO_VERSION}")
else() else()
# A tag has been found: use it as the Falco version # A tag has been found: use it as the Falco version
set(FALCO_VERSION "${FALCO_TAG}") set(FALCO_VERSION "${FALCO_TAG}")