-
set version using git describe + cmakedev/etc 2021. 3. 29. 20:51
v2.5-0-gdeadbee
^ ^ ^^
| | | |
| | | '-- SHA of HEAD (first seven chars)
| | '-- "g" is for git
| '---- number of commits since last tag
|
'--------- last tagstackoverflow.com/a/12368262/3543411
softwareengineering.stackexchange.com/a/141986
linux.die.net/man/1/git-describe
cmake
execute_process(COMMAND ${GIT_EXECUTABLE} describe --abbrev=4 --always --tags --long --dirty OUTPUT_VARIABLE _VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET RESULT_VARIABLE ret) target_compile_definitions(${PROJECT_NAME} PUBLIC _VERSION="${_VERSION}")
cmake.org/cmake/help/latest/command/execute_process.html
cmake.org/cmake/help/latest/command/target_compile_definitions.html