For my project I need to create executables with different “branding” (e.g. exe file name, window title, etc.), some of which needs to be compiled in (i.e. not runtime editable).
Since the branding will be modified by non-programmers I set up a JSON file that gets passed to CMake as a command-line argument (-DBranding=“MyBrand.json”). In my CMakeLists.txt I read the JSON file and use its values to populate preprocessor definitions that then get used in C++ code.
The trouble is that any changes to the JSON do not get picked up by ZERO_CHECK, the “let me re-run CMake for you, because CMake files changed” target.
Adding the JSON file to the executable target doesn’t help, because changes to the JSON file need to trigger a CMake re-run to update the preprocessor definitions. Re-compiling the target when the JSON changes is useless, because CMake didn’t change the preprocessor definitions.
Is it possible to add a file dependency to ZERO_CHECK? Similarly to how it already checks whether CMakePresets.json was modified after its last run, I’d like it to check the timestamp of my JSON file …