If I accidentally change a header file, save it, and then change it back and re-save, how do I stop cmake from detecting the change and rebuilding all its dependencies. Usually I don't even know it got modified until after I re-run make
and it starts a rebuild process.
I've tried some naive manual timestamp changes, but had no luck.
To be clear, I'm looking for a hack or someone who can explain the rules cmake uses. The environment is linux/os x using command line gcc/clang.
cmake
is a makefile generator (amongst other things it can generate). That's why you build with make
.
The behavior you see is indeed standard make
behavior. This is a generalized build tool; it rebuilds any "target" by applying the "recipe" for that target whenever the target is outdated. These targets and recipes have been written by cmake
.
You can ask make
which targets it would rebuild (make --dry-run
) and update the timestamp of the header to predate all targets (touch -r oldest_target header.h
). Alternatively, to avoid determining which target is oldest, alternate make --dry-run
and touch -r
using the first target until make --dry-run
returns no more targets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With