Set QT_PLUGIN_CLASS_NAME also on public plugins

... and update handling of CLASS_NAME in qt_internal_add_plugin

Change-Id: Iec8e5f9f80df02c9ba21648535872988839f4b64
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Mårten Nordheim 2020-04-28 14:07:29 +02:00
parent 6ffe9b1c42
commit cacac863e7
2 changed files with 16 additions and 2 deletions

View File

@ -2731,8 +2731,12 @@ function(qt_internal_add_plugin target)
# Derive the class name from the target name if it's not explicitly specified.
# Don't set it for qml plugins though.
set(plugin_class_name "")
if (NOT arg_CLASS_NAME AND NOT "${plugin_type_escaped}" STREQUAL "qml_plugin")
set(plugin_class_name "${target}")
if (NOT "${plugin_type_escaped}" STREQUAL "qml_plugin")
if (NOT arg_CLASS_NAME)
set(plugin_class_name "${target}")
else()
set(plugin_class_name "${arg_CLASS_NAME}")
endif()
endif()
qt_internal_check_directory_or_type(OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}" "${arg_TYPE}"

View File

@ -1140,6 +1140,7 @@ function(qt6_add_plugin target)
cmake_parse_arguments(arg
"STATIC"
"OUTPUT_NAME"
"CLASS_NAME"
""
${ARGN}
)
@ -1168,6 +1169,15 @@ function(qt6_add_plugin target)
)
endif()
# Derive the class name from the target name if it's not explicitly specified.
set(plugin_class_name "")
if (NOT arg_CLASS_NAME)
set(plugin_class_name "${target}")
else()
set(plugin_class_name "${arg_CLASS_NAME}")
endif()
set_target_properties(${target} PROPERTIES QT_PLUGIN_CLASS_NAME "${plugin_class_name}")
set(static_plugin_define "")
if (arg_STATIC)
set(static_plugin_define "QT_STATICPLUGIN")