2020-05-04 20:23:41 +00:00
|
|
|
set(VERSION_MAJOR 1)
|
|
|
|
set(VERSION_MINOR 12)
|
|
|
|
set(VERSION_PATCH 0)
|
|
|
|
set(VERSION_COMMIT 0)
|
|
|
|
|
2018-02-15 21:39:15 +00:00
|
|
|
find_program(GIT git)
|
2020-05-04 20:23:41 +00:00
|
|
|
if(GIT)
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${GIT} describe
|
2020-07-20 19:26:01 +00:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
2020-05-04 20:23:41 +00:00
|
|
|
OUTPUT_VARIABLE GIT_DESCRIBE_DIRTY
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
RESULT_VARIABLE GIT_DESCRIBE_RESULT
|
|
|
|
)
|
|
|
|
|
|
|
|
if(GIT_DESCRIBE_RESULT EQUAL 0)
|
|
|
|
string(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GIT_DESCRIBE_DIRTY}")
|
|
|
|
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${GIT_DESCRIBE_DIRTY}")
|
|
|
|
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${GIT_DESCRIBE_DIRTY}")
|
|
|
|
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+\\-([0-9]+).*" "\\1" VERSION_COMMIT "${GIT_DESCRIBE_DIRTY}")
|
|
|
|
else()
|
|
|
|
message(WARNING "git describe failed with exit code: ${GIT_DESCRIBE_RESULT}")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
message(WARNING "git is not found")
|
|
|
|
endif()
|
|
|
|
|
2020-12-07 19:50:29 +00:00
|
|
|
message(STATUS "Proceeding with version: ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_COMMIT}")
|