From cd12c1f33281452d478bb94744d76bead5c7363a Mon Sep 17 00:00:00 2001 From: Amir Masoud Abdol Date: Wed, 15 Mar 2023 10:46:22 +0100 Subject: [PATCH] Fix an issue with passing NO_UNITY_BUILD_SOURCES Amend 31518f1a4e3c4a7c77ae2e008e903a849ba75dd6 Amend 360293623094a31586981206e59c92aa6235163d Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ibb2fd881c02b6496f06b8b623fa6009358755a26 Reviewed-by: Alexandru Croitor --- cmake/QtExecutableHelpers.cmake | 10 ++++++++-- cmake/QtModuleHelpers.cmake | 10 ++++++++-- cmake/QtPluginHelpers.cmake | 20 +++++++++++++------- cmake/QtTargetHelpers.cmake | 4 +++- cmake/QtTestHelpers.cmake | 1 - cmake/QtToolHelpers.cmake | 10 ++++++++-- 6 files changed, 40 insertions(+), 15 deletions(-) diff --git a/cmake/QtExecutableHelpers.cmake b/cmake/QtExecutableHelpers.cmake index bd41c474eb..5efeb2a245 100644 --- a/cmake/QtExecutableHelpers.cmake +++ b/cmake/QtExecutableHelpers.cmake @@ -111,11 +111,17 @@ function(qt_internal_add_executable name) endif() if(arg_NO_UNITY_BUILD) - set(arg_NO_UNITY_BUILD NO_UNITY_BUILD) + set(arg_NO_UNITY_BUILD "NO_UNITY_BUILD") else() set(arg_NO_UNITY_BUILD "") endif() + if(arg_NO_UNITY_BUILD_SOURCES) + set(arg_NO_UNITY_BUILD_SOURCES "NO_UNITY_BUILD_SOURCES ${arg_NO_UNITY_BUILD_SOURCES}") + else() + set(arg_NO_UNITY_BUILD_SOURCES "") + endif() + qt_internal_extend_target("${name}" SOURCES ${arg_SOURCES} INCLUDE_DIRECTORIES ${private_includes} @@ -134,7 +140,7 @@ function(qt_internal_add_executable name) MOC_OPTIONS ${arg_MOC_OPTIONS} ENABLE_AUTOGEN_TOOLS ${arg_ENABLE_AUTOGEN_TOOLS} DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS} - NO_UNITY_BUILD_SOURCES ${arg_NO_UNITY_BUILD_SOURCES} + ${arg_NO_UNITY_BUILD_SOURCES} ${arg_NO_UNITY_BUILD} ) set_target_properties("${name}" PROPERTIES diff --git a/cmake/QtModuleHelpers.cmake b/cmake/QtModuleHelpers.cmake index 1c9efc6e2d..618889937b 100644 --- a/cmake/QtModuleHelpers.cmake +++ b/cmake/QtModuleHelpers.cmake @@ -574,11 +574,17 @@ function(qt_internal_add_module target) qt_internal_add_repo_local_defines("${target}") if(arg_NO_UNITY_BUILD) - set(arg_NO_UNITY_BUILD NO_UNITY_BUILD) + set(arg_NO_UNITY_BUILD "NO_UNITY_BUILD") else() set(arg_NO_UNITY_BUILD "") endif() + if(arg_NO_UNITY_BUILD_SOURCES) + set(arg_NO_UNITY_BUILD_SOURCES "NO_UNITY_BUILD_SOURCES ${arg_NO_UNITY_BUILD_SOURCES}") + else() + set(arg_NO_UNITY_BUILD_SOURCES "") + endif() + if(NOT arg_EXTERNAL_HEADERS) set(arg_EXTERNAL_HEADERS "") endif() @@ -614,7 +620,7 @@ function(qt_internal_add_module target) DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS} PRECOMPILED_HEADER ${arg_PRECOMPILED_HEADER} NO_PCH_SOURCES ${arg_NO_PCH_SOURCES} - NO_UNITY_BUILD_SOURCES ${arg_NO_UNITY_BUILD_SOURCES} + ${arg_NO_UNITY_BUILD_SOURCES} ${arg_NO_UNITY_BUILD} ) diff --git a/cmake/QtPluginHelpers.cmake b/cmake/QtPluginHelpers.cmake index bad3cac60d..835541fe09 100644 --- a/cmake/QtPluginHelpers.cmake +++ b/cmake/QtPluginHelpers.cmake @@ -312,12 +312,6 @@ function(qt_internal_add_plugin target) endif() endif() - if(arg_NO_UNITY_BUILD) - set(arg_NO_UNITY_BUILD NO_UNITY_BUILD) - else() - set(arg_NO_UNITY_BUILD "") - endif() - set_property(TARGET "${target}" PROPERTY QT_DEFAULT_PLUGIN "${_default_plugin}") set_property(TARGET "${target}" APPEND PROPERTY EXPORT_PROPERTIES "QT_PLUGIN_CLASS_NAME;QT_PLUGIN_TYPE;QT_MODULE;QT_DEFAULT_PLUGIN") @@ -333,6 +327,18 @@ function(qt_internal_add_plugin target) ${arg_PUBLIC_INCLUDE_DIRECTORIES} ) + if(arg_NO_UNITY_BUILD) + set(arg_NO_UNITY_BUILD "NO_UNITY_BUILD") + else() + set(arg_NO_UNITY_BUILD "") + endif() + + if(arg_NO_UNITY_BUILD_SOURCES) + set(arg_NO_UNITY_BUILD_SOURCES "NO_UNITY_BUILD_SOURCES ${arg_NO_UNITY_BUILD_SOURCES}") + else() + set(arg_NO_UNITY_BUILD_SOURCES "") + endif() + qt_internal_extend_target("${target}" SOURCES ${arg_SOURCES} INCLUDE_DIRECTORIES @@ -360,7 +366,7 @@ function(qt_internal_add_plugin target) MOC_OPTIONS ${arg_MOC_OPTIONS} ENABLE_AUTOGEN_TOOLS ${arg_ENABLE_AUTOGEN_TOOLS} DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS} - NO_UNITY_BUILD_SOURCES ${arg_NO_UNITY_BUILD_SOURCES} + ${arg_NO_UNITY_BUILD_SOURCES} ${arg_NO_UNITY_BUILD} ) diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake index b4cd5c81ae..765a769aca 100644 --- a/cmake/QtTargetHelpers.cmake +++ b/cmake/QtTargetHelpers.cmake @@ -217,11 +217,13 @@ function(qt_internal_extend_target target) ## Ignore objective-c files for PCH (not supported atm) qt_ignore_pch_obj_c_sources("${target}" "${arg_SOURCES}") - qt_update_ignore_unity_build_sources("${target}" "${arg_NO_UNITY_BUILD_SOURCES}") if(arg_NO_UNITY_BUILD) set_target_properties("${target}" PROPERTIES UNITY_BUILD OFF) qt_update_ignore_unity_build_sources("${target}" "${arg_SOURCES}") endif() + if(arg_NO_UNITY_BUILD_SOURCES) + qt_update_ignore_unity_build_sources("${target}" "${arg_NO_UNITY_BUILD_SOURCES}") + endif() else() if(QT_CMAKE_DEBUG_EXTEND_TARGET) message("qt_extend_target(${target} CONDITION ${arg_CONDITION} ...): Skipped") diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake index df477f53fe..967d8ff99b 100644 --- a/cmake/QtTestHelpers.cmake +++ b/cmake/QtTestHelpers.cmake @@ -327,7 +327,6 @@ function(qt_internal_add_test_to_batch batch_name name) ENABLE_AUTOGEN_TOOLS ${arg_ENABLE_AUTOGEN_TOOLS} DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS} NO_UNITY_BUILD # Tests should not be built using UNITY_BUILD - NO_UNITY_BUILD_SOURCES ${arg_SOURCES} ) foreach(source ${arg_SOURCES}) diff --git a/cmake/QtToolHelpers.cmake b/cmake/QtToolHelpers.cmake index 92bb3dc6d1..c63828ef8c 100644 --- a/cmake/QtToolHelpers.cmake +++ b/cmake/QtToolHelpers.cmake @@ -94,11 +94,17 @@ function(qt_internal_add_tool target_name) qt_internal_library_deprecation_level(deprecation_define) if(arg_NO_UNITY_BUILD) - set(arg_NO_UNITY_BUILD NO_UNITY_BUILD) + set(arg_NO_UNITY_BUILD "NO_UNITY_BUILD") else() set(arg_NO_UNITY_BUILD "") endif() + if(arg_NO_UNITY_BUILD_SOURCES) + set(arg_NO_UNITY_BUILD_SOURCES "NO_UNITY_BUILD_SOURCES ${arg_NO_UNITY_BUILD_SOURCES}") + else() + set(arg_NO_UNITY_BUILD_SOURCES "") + endif() + qt_internal_add_executable("${target_name}" OUTPUT_DIRECTORY "${output_dir}" ${exceptions} @@ -124,7 +130,7 @@ function(qt_internal_add_tool target_name) TARGET_DESCRIPTION "${arg_TARGET_DESCRIPTION}" TARGET_COMPANY "${arg_TARGET_COMPANY}" TARGET_COPYRIGHT "${arg_TARGET_COPYRIGHT}" - NO_UNITY_BUILD_SOURCES "${arg_NO_UNITY_BUILD_SOURCES}" + ${arg_NO_UNITY_BUILD_SOURCES} ${arg_NO_UNITY_BUILD} ) qt_internal_add_target_aliases("${target_name}")