AUTOGEN (AUTOMOC, AUTORCC) results in duplicate builds with Ninja + Clang
Since upgrading from CMake 3.8.2 to 3.9.2, my incremental builds recompiles much more than necessary. After many tests, I have isolated the issue to a specific configuration: Ninja combined with Clang. Ninja/Unix Makefiles with GCC work fine. Addition of ccache has no positive/negative effect. Having CMAKE_AUTOMOC=ON
is required to trigger the problem.
Reproducer:
- Grab the test case from #17161 (closed) (but rename
Example.qrc
toexample.qrc
due to a case-sensitive filesystem). It is important to haveCMAKE_AUTORCC
enabled. cmake -GNinja -DCMAKE_CXX_COMPILER=clang++ ../Src
-
ninja -v
(cold build) -
ninja -v
(incremental build)
Expected result: Step four should show not show the compile command.
Actual result: Step four recompiles the object file.
Further information:
- Distribution: Arch Linux
- ninja 1.8.1-1
- cmake 3.9.2-2
- gcc-multilib 7.2.01-1
- clang 4.0.1-5