Skip to content

AutoGen: Fix needless compilation of mocs_compilation.cpp

Alexey Edelev requested to merge semlanik/cmake:fix-22338 into master

For an AUTOMOC'ed target foo, when depfiles are used, there are the following dependencies:

foo_autogen -> foo_autogen/timestamp foo_autogen/mocs_compilation.cpp -> foo_autogen/timestamp

The first is used to trigger AUTOGEN. The second erroneously triggers a recompilation of mocs_compilation.cpp when any source file of target foo is touched.

Remove the latter dependency and replace it with an order-only dependency from foo_autogen/mocs_compilation.cpp to foo_autogen_timestamp_deps.

That is achieved by making mocs_compilation.cpp or its per-configuration variants byproduct(s) of the timestamp file.

Fixes: #22338 (closed)
Backport: release
Topic-rename: autogen-deps

Edited by Brad King

Merge request reports