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 cfd5485d41
Pick-to: 6.4 6.4.1
Fixes: QTBUG-107687
Fixes: QTBUG-108113
Task-number: QTBUG-103470
Change-Id: Ibddd05726deba2103c9c3c85a3fefd6d55798020
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
parent
83ecb65ec0
commit
c2aa05991d
@ -1822,13 +1822,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()
|
||||
|
Loading…
Reference in New Issue
Block a user