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. Pick-to: 6.2 Task-number: QTBUG-95731 Change-Id: Ic83a29d7c91492c302eb413a69577a0c550e1a1b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
b5b9c264dd
commit
d6661c5622
@ -20,8 +20,9 @@ macro(qt_internal_get_internal_add_plugin_keywords option_args single_args multi
|
|||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# This is the main entry point for defining Qt plugins.
|
# 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
|
# A CMake target is created with the given target.
|
||||||
# plugin into the correct plugins/ sub-directory.
|
# 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)
|
function(qt_internal_add_plugin target)
|
||||||
qt_internal_set_qt_known_plugins("${QT_KNOWN_PLUGINS}" "${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}")
|
set(plugin_type "${arg_PLUGIN_TYPE}")
|
||||||
endif()
|
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)
|
qt_get_sanitized_plugin_type("${plugin_type}" plugin_type_escaped)
|
||||||
|
|
||||||
set(output_directory_default "${QT_BUILD_DIR}/${INSTALL_PLUGINSDIR}/${plugin_type}")
|
set(output_directory_default "${QT_BUILD_DIR}/${INSTALL_PLUGINSDIR}/${plugin_type}")
|
||||||
|
Loading…
Reference in New Issue
Block a user