Fix warnings regarding QML plugins

Some author warnings don't make sense when dealing with QML
plugins, like the messages regarding CLASS_NAME or not
belonging to a certain module. Take care not to print those
warnings in those cases.

Change-Id: I017bd63cca650dc262337949242e813b7b6a56cc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Alexandru Croitor 2019-07-22 17:44:55 +02:00
parent f60e4058aa
commit 35fbe525fe

View File

@ -1534,7 +1534,7 @@ function(add_qt_plugin target)
set(archive_install_directory_default "${INSTALL_QMLDIR}/${target_path}")
endif()
if ("x${arg_CLASS_NAME}" STREQUAL x)
if ("x${arg_CLASS_NAME}" STREQUAL "x" AND NOT "${arg_TYPE}" STREQUAL "qml_plugin")
message(AUTHOR_WARNING "add_qt_plugin called without setting CLASS_NAME.")
endif()
@ -1574,8 +1574,10 @@ function(add_qt_plugin target)
endif()
# Save the Qt module in the plug-in's properties
qt_get_module_for_plugin("${target}" "${arg_TYPE}")
get_target_property(qt_module "${target}" QT_MODULE)
if(NOT arg_TYPE STREQUAL "qml_plugin")
qt_get_module_for_plugin("${target}" "${arg_TYPE}")
get_target_property(qt_module "${target}" QT_MODULE)
endif()
# Add the plug-in to the list of plug-ins of this module
if(TARGET "${qt_module}")