1
0
Fork 0
forked from lthn/blockchain
blockchain/src/version.cmake

11 lines
638 B
CMake
Raw Permalink Normal View History

2018-12-27 18:50:45 +03:00
execute_process(COMMAND "${GIT}" describe --dirty --match "v${VERSION}" RESULT_VARIABLE RET OUTPUT_VARIABLE DESCRIPTION OUTPUT_STRIP_TRAILING_WHITESPACE)
if(RET)
message(WARNING "Cannot determine current revision. Make sure that you are building either from a Git working tree or from a source archive.")
set(VERSION "${COMMIT}")
configure_file("src/version.h.in" "${TO}")
else()
string(REGEX MATCH "[^0-9a-f]([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f])[0-9a-f]*(-dirty)?" STUB_VAR "${DESCRIPTION}")
set(VERSION "${CMAKE_MATCH_1}${CMAKE_MATCH_2}")
2018-12-27 18:50:45 +03:00
configure_file("src/version.h.in" "${TO}")
endif()