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
Pick-to: 6.2 6.3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
bb10
Tim Blechmann 2022-03-24 09:40:40 +08:00
parent 7d8150da4c
commit 837bfd6f14
1 changed files with 5 additions and 2 deletions

View File

@ -377,8 +377,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)
@ -2017,6 +2019,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)