From 1fd21c47d0f459a66f6590f789755feb24ff1d9b Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 15 Nov 2019 15:43:20 +0100 Subject: [PATCH] Fix warnings when a module's plugin type has underscores In qtwayland, there were a bunch of warnings of the following type when configuring: "The plug-in 'f' does not belong to any Qt module". This happened because the plugin type had underscores, and was not sanitized when comparing a the plugin type of plugin. Add a function to do the sanitization, and use it everywhere. Change-Id: I728b5f1e18fa5f8876c4a57dbd4e33148cb242d5 Reviewed-by: Simon Hausmann Reviewed-by: Qt CMake Build Bot --- cmake/QtBuild.cmake | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 1e5c078eed..68729fe351 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -1317,6 +1317,12 @@ function(qt_skip_warnings_are_errors_when_repo_unclean target) endif() endfunction() +function(qt_get_sanitized_plugin_type plugin_type out_var) + # Used to handle some edge cases such as platforms/darwin + string(REGEX REPLACE "[-/]" "_" plugin_type "${plugin_type}") + set("${out_var}" "${plugin_type}" PARENT_SCOPE) +endfunction() + # This is the main entry function for creating a Qt module, that typically # consists of a library, public header files, private header files and configurable # features. @@ -1405,9 +1411,7 @@ function(qt_add_module target) 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}) - # Used to handle some edge cases such as platforms/darwin - string(REGEX REPLACE "[-/]" "_" plugin_type "${plugin_type}") - + 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() @@ -1755,6 +1759,8 @@ endfunction() # 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) qt_internal_get_qt_all_known_modules(known_modules) + + qt_get_sanitized_plugin_type("${target_type}" target_type) foreach(qt_module ${known_modules}) get_target_property(module_type "${QT_CMAKE_EXPORT_NAMESPACE}::${qt_module}" TYPE) # Assuming interface libraries can't have plugins. Otherwise we'll need to fix the property