2019-11-21 12:33:28 +00:00
|
|
|
include_guard(DIRECTORY)
|
2019-06-07 07:13:31 +00:00
|
|
|
@QT_MODULE_PLUGIN_INCLUDES@
|
|
|
|
|
2021-01-20 07:05:25 +00:00
|
|
|
# Use a function to hide all the temporary variables we use so they don't leak
|
|
|
|
# out into the consuming scope
|
|
|
|
function(__qt_internal_add_static_plugins_once)
|
2019-06-07 07:13:31 +00:00
|
|
|
set(_module_target "@INSTALL_CMAKE_NAMESPACE@::@QT_MODULE@")
|
2021-01-07 16:26:55 +00:00
|
|
|
set(_qt_plugins "")
|
2021-01-07 15:55:51 +00:00
|
|
|
|
2021-01-21 16:05:19 +00:00
|
|
|
# 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()
|
|
|
|
|
2021-04-28 14:27:19 +00:00
|
|
|
# Include all PluginConfig.cmake files and update the _qt_plugins and QT_PLUGINS property of
|
|
|
|
# the module. The underscored version is the one we will use going forward to have compatibility
|
|
|
|
# with INTERFACE libraries. QT_PLUGINS is now deprecated and only kept so that we don't break
|
|
|
|
# existing projects using it (like CMake itself).
|
2021-01-07 15:55:51 +00:00
|
|
|
file(GLOB _qt_plugin_config_files "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@*PluginConfig.cmake")
|
|
|
|
foreach(_config_file ${_qt_plugin_config_files})
|
|
|
|
string(REGEX REPLACE "^.*/@INSTALL_CMAKE_NAMESPACE@(.*Plugin)Config.cmake$" "\\1" _qt_plugin "${_config_file}")
|
|
|
|
include("${_config_file}")
|
2021-03-22 19:43:25 +00:00
|
|
|
if(TARGET "@INSTALL_CMAKE_NAMESPACE@::${_qt_plugin}")
|
|
|
|
list(APPEND _qt_plugins ${_qt_plugin})
|
|
|
|
endif()
|
2021-01-07 15:55:51 +00:00
|
|
|
endforeach()
|
2021-04-28 14:27:19 +00:00
|
|
|
set_property(TARGET ${_module_target} PROPERTY _qt_plugins ${_qt_plugins})
|
|
|
|
|
|
|
|
# TODO: Deprecated. Remove in Qt 7.
|
2021-01-07 15:55:51 +00:00
|
|
|
set_property(TARGET ${_module_target} PROPERTY QT_PLUGINS ${_qt_plugins})
|
|
|
|
|
2021-01-20 07:05:25 +00:00
|
|
|
get_target_property(_have_added_plugins_already ${_module_target} __qt_internal_plugins_added)
|
|
|
|
if(_have_added_plugins_already)
|
|
|
|
return()
|
|
|
|
endif()
|
2019-06-07 07:13:31 +00:00
|
|
|
|
2021-04-28 13:25:18 +00:00
|
|
|
foreach(plugin_target ${_qt_plugins})
|
|
|
|
__qt_internal_plugin_get_plugin_type("${plugin_target}" __has_plugin_type __plugin_type)
|
|
|
|
if(NOT __has_plugin_type)
|
|
|
|
continue()
|
2019-06-07 07:13:31 +00:00
|
|
|
endif()
|
|
|
|
|
2021-04-28 13:25:18 +00:00
|
|
|
__qt_internal_plugin_has_class_name("${plugin_target}" __has_class_name)
|
|
|
|
if(NOT __has_class_name)
|
|
|
|
continue()
|
2019-09-23 14:57:06 +00:00
|
|
|
endif()
|
|
|
|
|
2021-04-28 13:25:18 +00:00
|
|
|
list(APPEND "QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE_${__plugin_type}" "${plugin_target}")
|
2019-09-23 14:57:06 +00:00
|
|
|
|
2021-04-28 13:25:18 +00:00
|
|
|
__qt_internal_add_static_plugin_linkage("${plugin_target}" "${_module_target}")
|
|
|
|
__qt_internal_add_static_plugin_import_macro(
|
|
|
|
"${plugin_target}" ${_module_target} "@QT_MODULE@")
|
2019-06-07 07:13:31 +00:00
|
|
|
endforeach()
|
2021-01-20 07:05:25 +00:00
|
|
|
|
2021-04-28 13:25:18 +00:00
|
|
|
set("QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE_${__plugin_type}"
|
|
|
|
"${QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE_${__plugin_type}}"
|
|
|
|
PARENT_SCOPE
|
|
|
|
)
|
|
|
|
|
2021-01-20 07:05:25 +00:00
|
|
|
set_target_properties(${_module_target} PROPERTIES __qt_internal_plugins_added TRUE)
|
|
|
|
endfunction()
|
|
|
|
|
2021-02-15 01:18:28 +00:00
|
|
|
if(NOT @BUILD_SHARED_LIBS@ AND NOT QT_NO_CREATE_TARGETS)
|
2021-01-20 07:05:25 +00:00
|
|
|
__qt_internal_add_static_plugins_once()
|
2019-06-07 07:13:31 +00:00
|
|
|
endif()
|