fix(cmake): properly check that git describe returns a real tag (semversioned).

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

View File

@ -21,7 +21,8 @@ if(NOT FALCO_VERSION)
if(NOT FALCO_TAG)
# Obtain the closest tag
git_describe(FALCO_VERSION "--always" "--tags" "--abbrev=7")
if(FALCO_VERSION MATCHES "NOTFOUND$")
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
get_git_head_revision(refspec FALCO_HASH)
if(NOT FALCO_HASH OR FALCO_HASH MATCHES "NOTFOUND$")