I found this repo about creating a version file.
If I generate it for Ninja and modify the tags; the configured file is modified but the build stops at that step. If I build a second time the changes are detected
Yes, this is the wrong way of doing it. CMake doesn’t know that foobar_version.h is made by anything and it is only discovered by depfile = bits during the build.
See this project for how to do version embeddings properly. It uses its own sprokit_configure_file command that just “defers” configure_file to build time, but unpacking and redoing that should be a far better example to build on.