cmake: Teach qt_internal_extend_target about PLUGIN_TYPES

Change-Id: I2e8a3faa6ada66a644dceeb98f9ba8e994db4192
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Tor Arne Vestbø 2022-07-25 15:28:31 +02:00
parent 2979df59b9
commit bee6f47d22
3 changed files with 25 additions and 13 deletions

View File

@ -31,6 +31,26 @@ function(qt_internal_clear_qt_repo_known_plugin_types)
set(QT_REPO_KNOWN_PLUGIN_TYPES "" CACHE INTERNAL "Known current repo Qt plug-in types" FORCE)
endfunction()
function(qt_internal_add_plugin_types target plugin_types)
# Update the variable containing the list of plugins for the given plugin type
foreach(plugin_type ${plugin_types})
qt_get_sanitized_plugin_type("${plugin_type}" plugin_type)
set_property(TARGET "${target}" APPEND PROPERTY MODULE_PLUGIN_TYPES "${plugin_type}")
qt_internal_add_qt_repo_known_plugin_types("${plugin_type}")
endforeach()
# Save the non-sanitized plugin type values for qmake consumption via .pri files.
set_property(TARGET "${target}"
APPEND PROPERTY QMAKE_MODULE_PLUGIN_TYPES "${plugin_types}")
# Export the plugin types.
get_property(export_properties TARGET ${target} PROPERTY EXPORT_PROPERTIES)
if(NOT MODULE_PLUGIN_TYPES IN_LIST export_properties)
set_property(TARGET ${target} APPEND PROPERTY
EXPORT_PROPERTIES MODULE_PLUGIN_TYPES)
endif()
endfunction()
function(qt_internal_add_qt_repo_known_plugin_types)
set(QT_REPO_KNOWN_PLUGIN_TYPES ${QT_REPO_KNOWN_PLUGIN_TYPES} ${ARGN}
CACHE INTERNAL "Known current repo Qt plug-in types" FORCE)

View File

@ -396,19 +396,7 @@ function(qt_internal_add_module target)
if(NOT arg_HEADER_MODULE)
# Plugin types associated to a module
if(NOT "x${arg_PLUGIN_TYPES}" STREQUAL "x")
# Reset the variable containing the list of plugins for the given plugin type
foreach(plugin_type ${arg_PLUGIN_TYPES})
qt_get_sanitized_plugin_type("${plugin_type}" plugin_type)
set_property(TARGET "${target}" APPEND PROPERTY MODULE_PLUGIN_TYPES "${plugin_type}")
qt_internal_add_qt_repo_known_plugin_types("${plugin_type}")
endforeach()
# Save the non-sanitized plugin type values for qmake consumption via .pri files.
set_property(TARGET "${target}"
PROPERTY QMAKE_MODULE_PLUGIN_TYPES "${arg_PLUGIN_TYPES}")
# Export the plugin types.
set_property(TARGET ${target} APPEND PROPERTY EXPORT_PROPERTIES MODULE_PLUGIN_TYPES)
qt_internal_add_plugin_types("${target}" "${arg_PLUGIN_TYPES}")
endif()
endif()

View File

@ -91,6 +91,10 @@ function(qt_internal_extend_target target)
set_property (TARGET "${target}" APPEND PROPERTY
AUTOMOC_MOC_OPTIONS "${arg_MOC_OPTIONS}"
)
# Plugin types associated to a module
if(NOT "x${arg_PLUGIN_TYPES}" STREQUAL "x")
qt_internal_add_plugin_types("${target}" "${arg_PLUGIN_TYPES}")
endif()
endif()
# When computing the private library dependencies, we need to check not only the known