Remove automoc warnings when building plugins

Authored by jfita on May 17 2020, 9:17 PM.

Description

Remove automoc warnings when building plugins

Summary:
When building any plugin that uses the KREPORT_PLUGIN_FACTORY macro to
define the factory, CMake emits warnings like the following:

AutoMoc warning: The file includes the moc file "….moc", but does not contain a Q_OBJECT, Q_GADGET, Q_NAMESPACE, K_PLUGIN_FACTORY, K_PLUGIN_FACTORY_WITH_JSON or K_PLUGIN_CLASS_WITH_JSON macro.

That is because CMake looks for the Q_OBJECT and other such macros using
a regular expression, without expanding any macros, and therefore does
not know that KREPORT_PLUGIN_FACTORY in fact uses
K_PLUGIN_FACTORY_WITH_JSON.

ECM added a ECMSetupQtPluginMacroNames module in version 5.45 that
deals with this problem by appending the macro name to CMake’s
CMAKE_AUTOMOC_MACRO_NAMES and CMAKE_AUTOMOC_DEPEND_FILTERS variables.

Jarosław agreed to increase the required version of ECM in order to use this
macro.

FIXED-IN:3.3

Reviewers: staniek, piggz

Tags: KReport

Differential Revision: https://phabricator.kde.org/D28828

Details