e0ec19de41
User projects that use qt_add_qml_module faced unnecessary rebuilds when using the Unix Makefiles or Visual Studio project generators. The bug was in qt6_extract_metatypes. For the mentioned generators (and CMake 3.16 in general), we detect that CMake's AUTOMOC does not generate a dep file, and we use a custom target to trigger cmake_automoc_parser. That custom target runs always. Later, we call moc to generate meta_types/foo_metatypes.json.gen. To not trigger a rebuild of its dependents on every build, we use copy_if_different to generate meta_types/foo_metatypes.json only if the content changed. The custom command for that had two outputs: add_custom_command( OUTPUT ${metatypes_file_gen} ${metatypes_file} ... ) The Unix Makefile generator and the Visual Studio generator (and potentiall others) interpret this as "all outputs are always changed by this command". The Unix Makefile generator even ensures that by creating an additional foo_metatypes.json target that touches the file. In the generated Visual Studio project, the dependents of foo_metatypes.json are out of date even if the actual file has an old timestamp. In projects with QML modules, the QML type registration depends on this file. This caused a near full rebuild of the affected QML modules. We must mark foo_metatypes.json as byproduct of the command to specify that it is a file "whose modification time may or may not be newer than the dependencies". Unfortunately, there's CMake upstream issue #19005. There's a dependency missing between the consuming target and the byproduct. We must work around this issue with an additional custom command with OUTPUT ${metatypes_file}. Pick-to: 6.5 Fixes: QTBUG-106683 Change-Id: Icc2f7227c3e7b523631c1f361e29e26ae4efc46c Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> |
||
---|---|---|
.github/workflows | ||
bin | ||
cmake | ||
coin | ||
config.tests | ||
dist | ||
doc | ||
examples | ||
lib | ||
libexec | ||
LICENSES | ||
mkspecs | ||
qmake | ||
src | ||
tests | ||
util | ||
.cmake.conf | ||
.gitattributes | ||
.gitignore | ||
.lgtm.yml | ||
.tag | ||
CMakeLists.txt | ||
conanfile.py | ||
config_help.txt | ||
configure | ||
configure.bat | ||
configure.cmake | ||
dependencies.yaml | ||
qt_cmdline.cmake | ||
sync.profile |