summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-07-25 15:28:31 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-07-25 19:47:13 +0200
commitbee6f47d224e4e9f35d8994efa8d7c969a06d2c2 (patch)
treef5f8080db14a73aeac6c4bf22e53dcdb18fb543e /cmake
parent2979df59b97b06e0056e23bc81d30e831c3ef0ab (diff)
cmake: Teach qt_internal_extend_target about PLUGIN_TYPES
Change-Id: I2e8a3faa6ada66a644dceeb98f9ba8e994db4192 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtGlobalStateHelpers.cmake20
-rw-r--r--cmake/QtModuleHelpers.cmake14
-rw-r--r--cmake/QtTargetHelpers.cmake4
3 files changed, 25 insertions, 13 deletions
diff --git a/cmake/QtGlobalStateHelpers.cmake b/cmake/QtGlobalStateHelpers.cmake
index bb5a289c85..b498be8a94 100644
--- a/cmake/QtGlobalStateHelpers.cmake
+++ b/cmake/QtGlobalStateHelpers.cmake
@@ -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)
diff --git a/cmake/QtModuleHelpers.cmake b/cmake/QtModuleHelpers.cmake
index 087816a4bb..a02e7db324 100644
--- a/cmake/QtModuleHelpers.cmake
+++ b/cmake/QtModuleHelpers.cmake
@@ -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()
diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake
index c921759308..b220fdd9a5 100644
--- a/cmake/QtTargetHelpers.cmake
+++ b/cmake/QtTargetHelpers.cmake
@@ -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