mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-30 03:24:13 +08:00
mdbx-cmake: fix/refine git-fetch_version
macro for old branches.
Change-Id: Ied5b7c839da75de065fd86ec46da7b391022c948
This commit is contained in:
parent
7001d971e1
commit
603e250745
@ -113,6 +113,17 @@ macro(fetch_version name source_root_directory parent_scope)
|
||||
message(FATAL_ERROR "Please install latest version of git ('show --no-patch --format=%H HEAD' failed)")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${GIT} describe --tags --abbrev=0 "--match=v[0-9]*"
|
||||
OUTPUT_VARIABLE last_release_tag
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY ${source_root_directory}
|
||||
RESULT_VARIABLE rc)
|
||||
if(rc)
|
||||
message(FATAL_ERROR "Please install latest version of git ('describe --tags --abbrev=0 --match=v[0-9]*' failed)")
|
||||
endif()
|
||||
if (last_release_tag)
|
||||
set(git_revlist_arg "${last_release_tag}..HEAD")
|
||||
else()
|
||||
execute_process(COMMAND ${GIT} tag --sort=-version:refname
|
||||
OUTPUT_VARIABLE tag_list
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
@ -122,7 +133,6 @@ macro(fetch_version name source_root_directory parent_scope)
|
||||
message(FATAL_ERROR "Please install latest version of git ('tag --sort=-version:refname' failed)")
|
||||
endif()
|
||||
string(REGEX REPLACE "\n" ";" tag_list "${tag_list}")
|
||||
set(last_release_tag "")
|
||||
set(git_revlist_arg "HEAD")
|
||||
foreach(tag IN LISTS tag_list)
|
||||
if(NOT last_release_tag)
|
||||
@ -130,6 +140,7 @@ macro(fetch_version name source_root_directory parent_scope)
|
||||
set(git_revlist_arg "${tag}..HEAD")
|
||||
endif()
|
||||
endforeach(tag)
|
||||
endif()
|
||||
execute_process(COMMAND ${GIT} rev-list --count "${git_revlist_arg}"
|
||||
OUTPUT_VARIABLE ${name}_GIT_REVISION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
|
Loading…
x
Reference in New Issue
Block a user