diff options
author | Kai Köhne <kai.koehne@qt.io> | 2021-06-04 08:32:33 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-08-13 15:42:06 +0000 |
commit | fc6a50508dda4f7a7ab318ed99acf8bd63a43014 (patch) | |
tree | 2173c451339ad3634b5ab73a7b3917703f5f4c56 /cmake | |
parent | 1b1e4c8c1210f2e9957ccd2908049695d7ead716 (diff) |
CMake: Warn if qt_internal_plugin(target) does not end with 'Plugin'
The logic for linking plugins in a static build in Qt6*Plugins.cmake
looks up plugins that are named Qt6*PluginConfig.cmake, and the file
name is computed by the target name.
Not naming the target 'Plugin' therefore means it won't be picked up
in static builds.
Task-number: QTBUG-95731
Change-Id: Ic83a29d7c91492c302eb413a69577a0c550e1a1b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit d6661c56222250f75de64cda09aab1f3837db58c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtPluginHelpers.cmake | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cmake/QtPluginHelpers.cmake b/cmake/QtPluginHelpers.cmake index eae24faa9c..3b9206d68b 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}") |