diff --git a/cmake/QtPluginHelpers.cmake b/cmake/QtPluginHelpers.cmake index eae24faa9cb..3b9206d68bd 100644 --- a/cmake/QtPluginHelpers.cmake +++ b/cmake/QtPluginHelpers.cmake @@ -20,8 +20,9 @@ macro(qt_internal_get_internal_add_plugin_keywords option_args single_args multi endmacro() # This is the main entry point for defining Qt plugins. -# A CMake target is created with the given target. The PLUGIN_TYPE parameter is needed to place the -# plugin into the correct plugins/ sub-directory. +# A CMake target is created with the given target. +# The target name should end with "Plugin" so static plugins are linked automatically. +# The PLUGIN_TYPE parameter is needed to place the plugin into the correct plugins/ sub-directory. function(qt_internal_add_plugin target) qt_internal_set_qt_known_plugins("${QT_KNOWN_PLUGINS}" "${target}") @@ -87,6 +88,10 @@ function(qt_internal_add_plugin target) set(plugin_type "${arg_PLUGIN_TYPE}") endif() + if((NOT plugin_type STREQUAL "qml_plugin") AND (NOT target MATCHES "(.*)Plugin$")) + message(AUTHOR_WARNING "The internal plugin target name '${target}' should end with the 'Plugin' suffix.") + endif() + qt_get_sanitized_plugin_type("${plugin_type}" plugin_type_escaped) set(output_directory_default "${QT_BUILD_DIR}/${INSTALL_PLUGINSDIR}/${plugin_type}")