Details
-
Suggestion
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
6.4.2, 6.5.3
-
None
-
- Windows 11 64-bits 22H2
- QtCreator 11.0.3
- CMake 3.24.2, generator: Ninja 1.10.2
- MSVC2019 17.0.31919.166
Description
We have a project with ~5000 files, with ~half of them being QObject sub-classes.
Using this project with QtCreator, CMake and the MSVC2019 compiler, each time a file is added to the project and CMake is re-run, MOC seem to be reexecuted and it causes the recompilation of ~2500 files that haven't changed, wasting a lot of time (~10 min) each time.
This seems to be due to the MOC compiler overwritting all mocs during CMake and causing the compiler to recompile a lot of stuff for nothing, just because the file timestamp has changed.
If this is confirmed, maybe an option to avoid this could be in the MOC compiler to not simply overwrite a file on disk if there is already a file with an identical content at the same path, thus not changing the timestamp of the file if its content does not change. This means to read the file on disk (if it exists), compare its content with what is about to be written, and only write it if different.
We have applied this pattern to a code generator that generates C++ message classes for communication during the CMake step and it works well, saving precious time daily.
NOTE: This issue does not appear on Linux with ccache enabled.