From 566b726b8400d473861a62b4b9de87d1f0958d6d Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 12 Mar 2024 10:32:35 +0100 Subject: [PATCH] CMake: Create alias targets for plugin init targets When building tests in-tree targeting iOS, we run _qt_internal_finalize_executable via qt_internal_add_test_finalizers. This in turn calls __qt_internal_apply_plugin_imports_finalizer_mode which tries to link to versioned plugin int targets. Because the linked plugin init target is built in-tree as well, and did not have versioned alias targets created, configuration fails with: Target "tst_baseline_qsvgrenderer" links to: Qt6::QSvgIconPlugin_init but the target was not found. Make sure to create versioned alias targets for the plugin init targets. Amends 6c9f4f5ebcd35dc1a68c442d9fbf3ec48f30baca Pick-to: 6.7 Fixes: QTBUG-123186 Task-number: QTBUG-122181 Change-Id: I0048b724d465dc3c176d238d144feb072262d76e Reviewed-by: Alexey Edelev --- cmake/QtPluginHelpers.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/QtPluginHelpers.cmake b/cmake/QtPluginHelpers.cmake index bc0f651b99c..a34bcfda1bc 100644 --- a/cmake/QtPluginHelpers.cmake +++ b/cmake/QtPluginHelpers.cmake @@ -91,6 +91,11 @@ function(qt_internal_add_plugin target) qt6_add_plugin(${target} ${plugin_args}) qt_internal_mark_as_internal_library(${target}) + get_target_property(target_type "${target}" TYPE) + if(target_type STREQUAL STATIC_LIBRARY) + qt_internal_add_target_aliases("${plugin_init_target}") + endif() + set(plugin_type "") # TODO: Transitional: Remove the TYPE option handling after all repos have been converted to use # PLUGIN_TYPE. @@ -390,7 +395,6 @@ function(qt_internal_add_plugin target) qt_register_target_dependencies("${target}" "${arg_PUBLIC_LIBRARIES}" "${qt_libs_private}") - get_target_property(target_type "${target}" TYPE) if(target_type STREQUAL STATIC_LIBRARY) if(qt_module_target) qt_internal_link_internal_platform_for_object_library("${plugin_init_target}")