mirror of https://github.com/status-im/evmc.git
Cable 0.2.9: Fix gitinfo when no git
This commit is contained in:
parent
623ebc288e
commit
28d2fd54ba
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# This is internal variable automaticaly updated with external tools.
|
||||
# Use CABLE_VERSION variable if you need this information.
|
||||
set(version 0.2.8)
|
||||
set(version 0.2.9)
|
||||
|
||||
# For conveniance, add the project CMake module dir to module path.
|
||||
set(module_dir ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
|
|
@ -11,14 +11,19 @@ string(TIMESTAMP TIMESTAMP)
|
|||
# Read the git info from a file. The gitinfo is suppose to update the file
|
||||
# only if the information has changed.
|
||||
file(STRINGS ${OUTPUT_DIR}/gitinfo.txt gitinfo)
|
||||
list(GET gitinfo 0 describe)
|
||||
list(GET gitinfo 1 GIT_BRANCH)
|
||||
list(GET gitinfo 2 GIT_ORIGIN_URL)
|
||||
list(LENGTH gitinfo gitinfo_len)
|
||||
if(gitinfo_len LESS 3)
|
||||
message(WARNING "Git info not available")
|
||||
else()
|
||||
list(GET gitinfo 0 describe)
|
||||
list(GET gitinfo 1 GIT_BRANCH)
|
||||
list(GET gitinfo 2 GIT_ORIGIN_URL)
|
||||
endif()
|
||||
|
||||
# The output of `git describe --always --long --tags --match=v*`.
|
||||
string(REGEX MATCH "(v(.+)-([0-9]+)-g)?([0-9a-f]+)(-dirty)?" match "${describe}")
|
||||
|
||||
if(NOT match)
|
||||
if(DEFINED describe AND NOT match)
|
||||
message(WARNING "Cannot parse git describe: ${describe}")
|
||||
endif()
|
||||
|
||||
|
|
Loading…
Reference in New Issue