This commit is contained in:
parent
98c168cbf3
commit
babf17cf6f
1 changed files with 11 additions and 7 deletions
|
@ -5,15 +5,19 @@ project(cnorxz)
|
||||||
execute_process(COMMAND bash "-c" "git rev-parse HEAD" OUTPUT_VARIABLE GIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
execute_process(COMMAND bash "-c" "git rev-parse HEAD" OUTPUT_VARIABLE GIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
execute_process(COMMAND bash "-c" "git tag -l --sort=refname 'v*' | tail -n1" OUTPUT_VARIABLE GIT_TAG OUTPUT_STRIP_TRAILING_WHITESPACE)
|
execute_process(COMMAND bash "-c" "git tag -l --sort=refname 'v*' | tail -n1" OUTPUT_VARIABLE GIT_TAG OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
execute_process(COMMAND bash "-c" "git rev-list -n 1 ${GIT_TAG}" OUTPUT_VARIABLE GIT_TAG_HASH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
execute_process(COMMAND bash "-c" "git rev-list -n 1 ${GIT_TAG}" OUTPUT_VARIABLE GIT_TAG_HASH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
message(STATUS "${GIT_TAG}")
|
|
||||||
message(STATUS "${GIT_HASH}")
|
message(STATUS "${GIT_HASH}")
|
||||||
message(STATUS "${GIT_TAG_HASH}")
|
if("${GIT_TAG}" EQUAL "")
|
||||||
string(SUBSTRING "${GIT_TAG}" 1 -1 VERSION)
|
set(VERSION "v0.0.0-test")
|
||||||
if(NOT ("${GIT_HASH}" EQUAL "${GIT_TAG_HASH}"))
|
else()
|
||||||
string(SUBSTRING ${GIT_HASH} 0 7 GIT_HASH_SHORT)
|
message(STATUS "${GIT_TAG}")
|
||||||
set(VERSION "${VERSION}-${GIT_HASH_SHORT}")
|
message(STATUS "${GIT_TAG_HASH}")
|
||||||
|
string(SUBSTRING "${GIT_TAG}" 1 -1 VERSION)
|
||||||
|
if(NOT ("${GIT_HASH}" EQUAL "${GIT_TAG_HASH}"))
|
||||||
|
string(SUBSTRING ${GIT_HASH} 0 7 GIT_HASH_SHORT)
|
||||||
|
set(VERSION "${VERSION}-${GIT_HASH_SHORT}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.0)
|
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.0)
|
||||||
message(FATAL_ERROR "require gcc version >= 7.0")
|
message(FATAL_ERROR "require gcc version >= 7.0")
|
||||||
|
|
Loading…
Reference in a new issue