Make qt_get_module_for_plugin() internal and do what its name says
Contrary to its name, this command was also setting a target property. Since it was only called in one place and that caller can just as easily set the property instead, rename the command to make clear its internal nature and refactor it so that the caller is responsible for setting that property instead. Also make it an error rather than just a warning if the command is used for a target that doesn't belong to any module. Since this is now unambiguously an internal command, we should always expect the target to belong to a module. Change-Id: I929a652ddd482653868fc9df887f38f4bc7f35d9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit c6bbca748659468b99002ec4b71559c65963b950) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
32d00fdfb3
commit
58ac65008e
@ -128,8 +128,8 @@ function(qt_internal_add_plugin target)
|
||||
|
||||
# Save the Qt module in the plug-in's properties
|
||||
if(NOT plugin_type_escaped STREQUAL "qml_plugin")
|
||||
qt_get_module_for_plugin("${target}" "${plugin_type_escaped}")
|
||||
get_target_property(qt_module "${target}" QT_MODULE)
|
||||
qt_internal_get_module_for_plugin("${target}" "${plugin_type_escaped}" qt_module)
|
||||
set_target_properties("${target}" PROPERTIES QT_MODULE "${qt_module}")
|
||||
set(plugin_install_package_suffix "${qt_module}")
|
||||
endif()
|
||||
|
||||
@ -328,8 +328,7 @@ function(qt_get_sanitized_plugin_type plugin_type out_var)
|
||||
endfunction()
|
||||
|
||||
# Utility function to find the module to which a plug-in belongs.
|
||||
# This will set the QT_MODULE target property on the plug-in - e.g. "Gui", "Sql"...
|
||||
function(qt_get_module_for_plugin target target_type)
|
||||
function(qt_internal_get_module_for_plugin target target_type out_var)
|
||||
qt_internal_get_qt_all_known_modules(known_modules)
|
||||
|
||||
qt_get_sanitized_plugin_type("${target_type}" target_type)
|
||||
@ -344,14 +343,10 @@ function(qt_get_module_for_plugin target target_type)
|
||||
get_target_property(plugin_types
|
||||
"${QT_CMAKE_EXPORT_NAMESPACE}::${qt_module}"
|
||||
MODULE_PLUGIN_TYPES)
|
||||
if(plugin_types)
|
||||
foreach(plugin_type ${plugin_types})
|
||||
if("${target_type}" STREQUAL "${plugin_type}")
|
||||
set_target_properties("${target}" PROPERTIES QT_MODULE "${qt_module}")
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
if(plugin_types AND target_type IN_LIST plugin_types)
|
||||
set("${out_var}" "${qt_module}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
message(AUTHOR_WARNING "The plug-in '${target}' does not belong to any Qt module.")
|
||||
message(FATAL_ERROR "The plug-in '${target}' does not belong to any Qt module.")
|
||||
endfunction()
|
||||
|
Loading…
x
Reference in New Issue
Block a user