4 ms·
I do not understand the "dummy output" technique. Since nothing depends on _version.cpp, why does its existence force the command to be re-run? The usual techn
by ridiculous_fish 7y ago
I do not understand the "dummy output" technique. Since nothing depends on _version.cpp, why does its existence force the command to be re-run?
The usual technique is to have some script check the git version, then output two files: the version.cpp file, and a "witness" file which changes every run. The script should be careful to not perturb the mod date of version.cpp unless it has changed.
This is coupled with Ninja's "restat" option. Without that option, Ninja will observe that version.cpp will be recreated and schedule all of its dependents (such as linking). With that option, Ninja will behave more like Make, check if the file was actually modified.
See CMake's (weirdly-placed) docs on this: https://cmake.org/cmake/help/v3.4/policy/CMP0058.html https://cmake.org/cmake/help/v3.4/policy/CMP0058.html
Here's fish shell's version gen script: https://github.com/fish-shell/fish-shell/blob/master/build_tools/git_version_gen.sh https://github.com/fish-shell/fish-shell/blob/master/build_t...