fix(cmake): fixed tag fetching fallback (that is indeed needed).

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
This commit is contained in:
Federico Di Pierro
2023-02-07 12:45:43 +01:00
committed by poiana
parent b978e71919
commit d5907f612c

View File

@@ -19,6 +19,9 @@ 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")
if(FALCO_VERSION MATCHES "NOTFOUND$")
# 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 +45,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}")