mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
Properly persist git hash on each build Rebuild `git_hash.h` only when `.git` folder changes `add_custom_target()` always considers its target out-of-date which leads to rebuilding of `git_hash.h` on every build (which is ironically what we wanted) and consequently rebuilding of build_options.c and relinking of c3c even when no changes are made, which is mildly annoying. We are replacing `add_custom_target()` with `add_custom_command()` which depends on `.git`, so `git_hash.h` is only rebuilt if any git commands are performed. Which is less annoying. In case of no `.git` we simply do not depend on it which leads to `git_hash.h` being rebuilt only once.