diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-10-17 15:23:27 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-11-03 08:03:13 +0000 |
commit | 87a8f36ff74f80b4deff062eb585009fdd4c74cf (patch) | |
tree | c68498b8b40a92da58dd60a4d85701e32891c78a | |
parent | 96b3382ec7879c577b4bc2a4881221154cccc3ce (diff) | |
download | qtbase-87a8f36ff74f80b4deff062eb585009fdd4c74cf.tar.gz |
CMake: Fix qt_add_resources missing dependency regression
Adding target dependencies instead of file dependencies to the
qrc processing custom command broke regeneration of the qrc
file when translation source files were touched, as well as caused
flaky build failures.
Originally, the target dependencies were added to work around an
issue with the Xcode generator (a custom command needing a
common target).
Limit the usage of target dependencies 'approach' to the Xcode
generator only.
This fixes the regression for non-Xcode generators, but will still
cause issues for iOS + Xcode.
A proper fix for Xcode will need more research.
Amends 5b0e765ab0dddba86662925cb44aeac748a286b7 in qttools
Amends cfd5485d41b2bf519d5b3c5162726cce195782ac
Fixes: QTBUG-107687
Fixes: QTBUG-108113
Task-number: QTBUG-103470
Change-Id: Ibddd05726deba2103c9c3c85a3fefd6d55798020
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit c2aa05991d79df57f826606157056c658c6de797)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/corelib/Qt6CoreMacros.cmake | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index 48c2ac4f64..cd8c951482 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -1709,13 +1709,20 @@ function(_qt_internal_process_resource target resourceName) endif() get_source_file_property( target_dependency ${file} ${scope_args} _qt_resource_target_dependency) - if (NOT target_dependency) - list(APPEND resource_dependencies ${file}) - else() - if (NOT TARGET ${target_dependency}) - message(FATAL_ERROR "Target dependency on resource file ${file} is not a cmake target.") + + # The target dependency code path does not take care of rebuilds when ${file} + # is touched. Limit its usage to the Xcode generator to avoid the Xcode common + # dependency issue. + # TODO: Figure out how to avoid the issue on Xcode, while also enabling proper + # dependency tracking when ${file} is touched. + if(target_dependency AND CMAKE_GENERATOR STREQUAL "Xcode") + if(NOT TARGET ${target_dependency}) + message(FATAL_ERROR + "Target dependency on resource file ${file} is not a cmake target.") endif() list(APPEND resource_dependencies ${target_dependency}) + else() + list(APPEND resource_dependencies ${file}) endif() _qt_internal_expose_source_file_to_ide(${target} "${file}") endforeach() |