There is more

We could enhance the recipe in order to include extra information in addition to the recorded Git hash. It is not unusual to detect whether the build environment is "dirty", that is, whether it contains uncommitted changes and untracked files, or "clean". This information could be detected using git describe --abbrev=7 --long --always --dirty --tags. Depending on the ambition for reproducibility one could even record the full output of git status into a header file but we leave these enhancements as an exercise.

Get CMake Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.