Ah, that's a good tip Elvis. The CONFIGURE_DEPENDS on the .git/index would do the trick. I can set that up for now.
In the long run, its not that ideal because it forces a reconfigure on every commit (which is annoying for developers at their desk). My example above is actually a little more complex in real life. I just simplified it for this e-mail. We only append the git hash to our version string if we are on certain branches. So our version string doesn't change on feature branches. For now I think we'll bite the bullet and re-configure on every commit. I'll keep mulling over the how to set this up. Thanks for the idea! -Matt On Thu, Oct 11, 2018 at 12:26 PM Chuck Atkins <chuck.atk...@kitware.com> wrote: > > >> 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 > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake