CMake: Work around Qt6::ATSPI2_nolink issue

This works around QTBUG-97023.

When building the Qt Creator super repo against the installer-provided Qt 6.2.0 on Linux,
Qt6Gui creates an imported library target named Qt6::ATSPI2_nolink.
This one must also be promoted to global scope.
Otherwise, subsequent find_package(Qt6 COMPONENTS Gui) calls fail with

  Some (but not all) targets in this export set were already defined.
  Targets Defined: Qt6::Gui;Qt6::GuiPrivate
  Targets not yet defined: Qt6::ATSPI2_nolink

Add Qt6::ATSPI2_nolink to the components that are promoted and aliased.

Change-Id: I39c46e8f1c831e2fad2aa4e928b785da08a0407c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Joerg Bornemann
2021-10-01 12:47:33 +02:00
parent ab16f2984b
commit 068c4e9b7b

View File

@@ -57,7 +57,8 @@ else()
find_package(Qt6 CONFIG ${__arguments} ${Qt5_FIND_COMPONENTS}) find_package(Qt6 CONFIG ${__arguments} ${Qt5_FIND_COMPONENTS})
endif() endif()
foreach(comp IN LISTS Qt5_FIND_COMPONENTS) set(__additional_imported_components ATSPI2_nolink) # Work around QTBUG-97023
foreach(comp IN LISTS Qt5_FIND_COMPONENTS __additional_imported_components)
if(TARGET Qt6::${comp}) if(TARGET Qt6::${comp})
if (NOT TARGET Qt5::${comp}) if (NOT TARGET Qt5::${comp})
set_property(TARGET Qt6::${comp} PROPERTY IMPORTED_GLOBAL TRUE) set_property(TARGET Qt6::${comp} PROPERTY IMPORTED_GLOBAL TRUE)