[CMake] Putting the git commit hash in a cmake variable

Chuck Atkins chuck.atkins at kitware.com
Thu Oct 11 15:25:54 EDT 2018


>     COMMAND "${GIT_EXECUTABLE}" describe --always HEAD
>

git describe is nice way to do it since you can get a monotonic-ish
increasing version number


>
>     string(REGEX REPLACE "^.*-(.*)-g.*$" "\\1" MYAPP_VERSION_MICRO
> "${MYAPP_VERSION}")
> ...
>     set(MYAPP_VERSION_MICRO "0")
>

Only tangentially related, CMake commands and functions that deal with
version information refer to the 4th component as _TWEAK.

- Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20181011/af0f1acd/attachment-0001.html>


More information about the CMake mailing list