Fix static top-level build

Commit d0071a4f87 broke static top-level builds:

CMake Error at .../qtbase/lib/cmake/Qt6Gui/Qt6GuiPlugins.cmake:17 (set_property):
  set_property can not be used on an ALIAS target.

Fixed by moving the un-aliasing of the target before the set_property
call.

Pick-to: 6.0
Change-Id: I96c731353798a58ff9b3a664f3614ef03c897dcb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Joerg Bornemann 2021-01-21 17:05:19 +01:00
parent 7cf8e5ada9
commit 3c54b72961

View File

@ -7,6 +7,13 @@ function(__qt_internal_add_static_plugins_once)
set(_module_target "@INSTALL_CMAKE_NAMESPACE@::@QT_MODULE@")
set(_qt_plugins "")
# Properties can't be set on aliased targets, so make sure to unalias the target. This is needed
# when Qt examples are built as part of the Qt build itself.
get_target_property(_aliased_target ${_module_target} ALIASED_TARGET)
if(_aliased_target)
set(_module_target ${_aliased_target})
endif()
# Include all PluginConfig.cmake files and update the QT_PLUGINS property of the module.
file(GLOB _qt_plugin_config_files "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@*PluginConfig.cmake")
foreach(_config_file ${_qt_plugin_config_files})
@ -16,13 +23,6 @@ function(__qt_internal_add_static_plugins_once)
endforeach()
set_property(TARGET ${_module_target} PROPERTY QT_PLUGINS ${_qt_plugins})
# Properties can't be set on aliased targets, so make sure to unalias the target. This is needed
# when Qt examples are built as part of the Qt build itself.
get_target_property(_aliased_target ${_module_target} ALIASED_TARGET)
if(_aliased_target)
set(_module_target ${_aliased_target})
endif()
get_target_property(_have_added_plugins_already ${_module_target} __qt_internal_plugins_added)
if(_have_added_plugins_already)
return()