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 "") if(GIT_TAG STREQUAL "")
git_latest_tag(GIT_TAG) git_latest_tag(GIT_TAG)
endif() endif()
if(GIT_TAG STREQUAL "HEAD-HASH-NOTFOUND")
set(GIT_TAG "1.0.0")
endif ()
git_describe(GIT_DESCRIBE) git_describe(GIT_DESCRIBE)
if(GIT_DESCRIBE STREQUAL "HEAD-HASH-NOTFOUND")
set(GIT_DESCRIBE "1.0.0")
endif ()
git_commit_counts(GIT_COMMIT_COUNT) git_commit_counts(GIT_COMMIT_COUNT)
if(GIT_COMMIT_COUNT STREQUAL "GIT-TAG-NOTFOUND") _git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR)
set(GIT_COMMIT_COUNT "1") if(NOT IS_DIRECTORY ${GIT_DIR})
endif () 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(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]+" GIT_SEMVER "${GIT_TAG}")
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" SEMVER_SPLITED "${GIT_SEMVER}") string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" SEMVER_SPLITED "${GIT_SEMVER}")