Avoid complete rebuild on cmake run with git info change
Before this commit, the following will trigger a complete rebuild: - create another git name (git checkout -b test) - run cmake again manually (cmake ..) - run ninja again The top-level CMakeLists.txt uses add_definitions() to add git information to all targets; if some git information changes, this will mark all command lines as dirty, triggering the build. There is an easy solution: instead of passing this information on the command line, pass it in a header. This commit uses configure_file() to generate a file oai_version.h in the build directory with the same information. Various sources files, e.g., main executables, use this to output the same information as before. It is then also not necessary to use header guards, as cmake takes care to create this file. If cmake is re-run, it will update the header, and trigger only files including this header will be rebuilt (which can be shown with the above stpes). The information passed is the same as before, and updates the information when the old method would have updated it.
Showing
common/oai_version.h.in
0 → 100644
Please register or sign in to comment