I’m trying to get git information for my project build. The “execute_process” command runs during the configuration of the project (“cmake /path/to/project/”):
You can use add_custom_command(OUTPUT does_not_exist COMMAND …) to get it to run all the time. Just make sure does_not_exist doesn’t exist and the build tools will always try to update it on every run.
Note that controlling the scheduling is not possible, so it can run at any point during the build, not just at the beginning, though you can write a real file which is additionally listed in OUTPUTS and tack that into the dependency graph via add_custom_target(run_git DEPENDS touched_file) then depending on that from wherever you need.