CMake: Warn about additional arguments to qt_add_plugin()

From Qt 6.5 onwards, qt_add_plugin() supports passing source files.
Let's warn if people use that feature for Qt 6.4, or older versions.

Pick-to: 6.2
Task-number: QTBUG-104189
Change-Id: Iee6592720500db3f45705f13a3c4fde6eb29e264
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Kai Köhne 2022-12-12 12:56:45 +01:00
parent 003d30fac2
commit 2706f8c787

View File

@ -1842,6 +1842,10 @@ function(qt6_add_plugin target)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
if (arg_UNPARSED_ARGUMENTS)
message(AUTHOR_WARNING "Unexpected arguments: ${arg_UNPARSED_ARGUMENTS}. If these are source files, consider using target_sources() instead.")
endif()
# Handle the inconsistent CLASSNAME/CLASS_NAME keyword naming between commands
if(arg_CLASSNAME)
if(arg_CLASS_NAME AND NOT arg_CLASSNAME STREQUAL arg_CLASS_NAME)