This commit is contained in:
朱子楚\zhuzi 2023-08-23 20:36:09 +08:00
parent f913263de6
commit 1c81ce299b

View File

@ -292,20 +292,17 @@ git_get_exact_tag(GIT_EXACT_TAG)
if(GIT_TAG STREQUAL "")
git_latest_tag(GIT_TAG)
endif()
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 ()
_git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR)
if(NOT IS_DIRECTORY ${GIT_DIR})
message(".git not exist")
set(GIT_COMMIT_COUNT "1")
set(GIT_DESCRIBE "1.0.0")
set(GIT_TAG "1.0.0")
else()
message(".git exist")
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}")