From 1abf11b479f028ff9b3377929270afe5c41c792e Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 24 Mar 2022 09:40:40 +0800 Subject: [PATCH] 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 Reviewed-by: Alexandru Croitor (cherry picked from commit 837bfd6f145402c94570d1df4fb3446664cb7828) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/Qt6CoreMacros.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index b0a5fad15ff..2c7d0d6f467 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -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)