# Changes not detected correctly for a ninja build

**URL:** <https://discourse.cmake.org/t/changes-not-detected-correctly-for-a-ninja-build/9639>\
**Category:** Code\
**Tags:** os:windows, gen:ninja\
**Created:** [December 15, 2023, 11:32am UTC](https://discourse.cmake.org/t/changes-not-detected-correctly-for-a-ninja-build/9639 "2023-12-15T11:32:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavidRegan](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/d07c76/32.png) [@DavidRegan](https://discourse.cmake.org/u/DavidRegan)\
**Post date:** [December 15, 2023, 11:32am UTC](https://discourse.cmake.org/t/changes-not-detected-correctly-for-a-ninja-build/9639/1 "2023-12-15T11:32:47Z")

</div>

Using Windows; mingw64 and Git for Windows

I found [this repo](https://github.com/nocnokneo/cmake-git-versioning-example/) 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

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [December 19, 2023, 3:41am UTC](https://discourse.cmake.org/t/changes-not-detected-correctly-for-a-ninja-build/9639/2 "2023-12-19T03:41:03Z")

</div>

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](https://github.com/Kitware/sprokit/blob/master/src/sprokit/CMakeLists.txt) 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.
