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 <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2024-03-12 10:32:35 +01:00
parent bce2522ad0
commit 566b726b84

View File

@ -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}")