This commit is contained in:
zhuzichu 2023-08-23 16:13:12 +08:00
parent 6b92372c59
commit f058496eb3

View File

@ -292,11 +292,20 @@ git_get_exact_tag(GIT_EXACT_TAG)
if(GIT_TAG STREQUAL "")
git_latest_tag(GIT_TAG)
endif()
if(GIT_TAG STREQUAL "GIT-TAG-NOTFOUND")
if(GIT_TAG STREQUAL "HEAD-HASH-NOTFOUND")
set(GIT_TAG "1.0.0")
endif ()
git_describe(GIT_DESCRIBE)
if(GIT_DESCRIBE STREQUAL "HEAD-HASH-NOTFOUND")
set(GIT_DESCRIBE "1.0.0")
endif ()
git_commit_counts(GIT_COMMIT_COUNT)
if(GIT_COMMIT_COUNT STREQUAL "GIT-TAG-NOTFOUND")
set(GIT_COMMIT_COUNT "1")
endif ()
string(REPLACE "." "," GIT_TAG_WITH_COMMA ${GIT_TAG})
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" GIT_SEMVER "${GIT_TAG}")
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" SEMVER_SPLITED "${GIT_SEMVER}")