path: root/src/platformsupport/devicediscovery
diff options
authorJoerg Bornemann <>2023-05-17 16:59:03 +0200
committerJoerg Bornemann <>2023-06-04 20:44:39 +0200
commite0ec19de415a06bf6a0c401175f1c1908dfde68f (patch)
treeba313b1da3251f345968dfb9a74dab6f43d1d04e /src/platformsupport/devicediscovery
parent8a9e3c78694f85582c53c66fd7dbdc7e0e5f4ab3 (diff)
CMake: Fix unnecessary rebuilds in Visual Studio projectsHEADdev6.6
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 <>
Diffstat (limited to 'src/platformsupport/devicediscovery')
0 files changed, 0 insertions, 0 deletions