cmake: skip unity build inclusion of generated resources

generated resource files contain static variables like
`qt_resource_data`. if multiple resources are included in unity builds,
we end up with name clashes, so we should exclude them

Change-Id: I8cbe73a9e3ce3808a142b7cb6315355a7d4161db
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 837bfd6f145402c94570d1df4fb3446664cb7828)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tim Blechmann 2022-03-24 09:40:40 +08:00 committed by Qt Cherry-pick Bot
parent 2643b98f27
commit 1abf11b479

View File

@ -369,8 +369,10 @@ function(qt6_add_resources outfiles )
MAIN_DEPENDENCY ${infile}
DEPENDS ${_rc_depends} "${_out_depends}" ${QT_CMAKE_EXPORT_NAMESPACE}::rcc
VERBATIM)
set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC ON)
set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOUIC ON)
set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC ON
SKIP_AUTOUIC ON
SKIP_UNITY_BUILD_INCLUSION ON
)
list(APPEND ${outfiles} ${outfile})
endforeach()
set(${outfiles} ${${outfiles}} PARENT_SCOPE)
@ -1991,6 +1993,7 @@ function(_qt_internal_process_resource target resourceName)
set_source_files_properties(${generatedOutfile} ${scope_args} PROPERTIES
SKIP_AUTOGEN TRUE
GENERATED TRUE
SKIP_UNITY_BUILD_INCLUSION TRUE
)
get_target_property(target_source_dir ${target} SOURCE_DIR)
if(NOT target_source_dir STREQUAL CMAKE_CURRENT_SOURCE_DIR)