Consider the versioned Qt6::Gui when target when adding the plugin dependencies

QtGui module can be linked using both versioned and non versioned
targets. Consider this when adding the dependencies to the
qpa_default_plugins targets.

Pick-to: 6.7
Change-Id: Iccbf3009ab8a4f9df4de1677f1b41445814c8c9e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2024-03-28 10:59:31 +01:00
parent c7176f3142
commit 1e8a36e360

View File

@ -212,7 +212,8 @@ function(qt_internal_add_executable name)
# This makes the experience of an initial Qt configuration to build and run one single
# test / executable nicer.
get_target_property(linked_libs "${name}" LINK_LIBRARIES)
if("Qt::Gui" IN_LIST linked_libs AND TARGET qpa_default_plugins)
if(linked_libs MATCHES "(^|;)(${QT_CMAKE_EXPORT_NAMESPACE}::|Qt::)?Gui($|;)" AND
TARGET qpa_default_plugins)
add_dependencies("${name}" qpa_default_plugins)
endif()
endfunction()