From f90e29fd5c9fb528e04c2ca5a0dcf40dd3d03c8e Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Tue, 10 Sep 2024 18:20:51 +0200 Subject: [PATCH] Consider the main target flags related properties when building object libraries The object libraries that are side products from building plugins should also consider the properties that control the flag handling of their main plugin targets, otherwise they will inherit the PlatformInternal flags without knowing what their parent decide. Functionality now considers QT_SKIP_WARNINGS_ARE_ERRORS and _qt_internal_use_exceptions properties. The list can be extended in the future. Change-Id: If304b3b382d6cd05064bc87e11d3cc87ba7c0d7b Reviewed-by: Alexandru Croitor --- cmake/QtPluginHelpers.cmake | 3 ++- cmake/QtResourceHelpers.cmake | 3 ++- cmake/QtTargetHelpers.cmake | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cmake/QtPluginHelpers.cmake b/cmake/QtPluginHelpers.cmake index ae73ee5aa79..ec7782fa9e8 100644 --- a/cmake/QtPluginHelpers.cmake +++ b/cmake/QtPluginHelpers.cmake @@ -339,7 +339,8 @@ function(qt_internal_add_plugin target) if(target_type STREQUAL STATIC_LIBRARY) if(qt_module_target) - qt_internal_link_internal_platform_for_object_library("${plugin_init_target}") + qt_internal_link_internal_platform_for_object_library("${plugin_init_target}" + PARENT_TARGET "${target}") endif() endif() diff --git a/cmake/QtResourceHelpers.cmake b/cmake/QtResourceHelpers.cmake index 2df1fed50fa..02f047678dd 100644 --- a/cmake/QtResourceHelpers.cmake +++ b/cmake/QtResourceHelpers.cmake @@ -111,7 +111,8 @@ function(qt_internal_record_rcc_object_files target resource_targets) endif() set_property(TARGET ${target} APPEND PROPERTY _qt_rcc_objects "${rcc_object_file_path}") - qt_internal_link_internal_platform_for_object_library("${out_target}") + qt_internal_link_internal_platform_for_object_library("${out_target}" + PARENT_TARGET "${target}") endforeach() endfunction() diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake index af840bb3e44..683b3c1af03 100644 --- a/cmake/QtTargetHelpers.cmake +++ b/cmake/QtTargetHelpers.cmake @@ -1457,6 +1457,7 @@ function(qt_internal_is_target_skipped_for_examples target out_var) endfunction() function(qt_internal_link_internal_platform_for_object_library target) + cmake_parse_arguments(arg "" "PARENT_TARGET" "" ${ARGN}) # We need to apply iOS bitcode flags to object libraries that are associated with internal # modules or plugins (e.g. object libraries added by qt_internal_add_resource, # qt_internal_add_plugin, etc.) @@ -1464,6 +1465,13 @@ function(qt_internal_link_internal_platform_for_object_library target) # present by default. # Achieve this by compiling the cpp files with the PlatformModuleInternal compile flags. target_link_libraries("${target}" PRIVATE Qt::PlatformModuleInternal) + + if(arg_PARENT_TARGET AND TARGET "${arg_PARENT_TARGET}") + foreach(property QT_SKIP_WARNINGS_ARE_ERRORS _qt_internal_use_exceptions) + set_property(TARGET "${target}" PROPERTY + ${property} "$>") + endforeach() + endif() endfunction() # Use ${dep_target}'s include dirs when building ${target}.