Remove automoc warnings when building plugins
ClosedPublic

Authored by jfita on Apr 14 2020, 2:33 PM.

Details

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

Diff Detail

Repository
R14 KReport
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
jfita created this revision.Apr 14 2020, 2:33 PM
Restricted Application added a project: KReport. · View Herald TranscriptApr 14 2020, 2:33 PM
jfita requested review of this revision.Apr 14 2020, 2:33 PM

Nice, but question, would it be possible to use ecm_setup_qtplugin_macro_names() ? https://api.kde.org/ecm/module/ECMSetupQtPluginMacroNames.html

In master (3.3) we can have dependency on ECM 5.45.
How about not making a change in 3.2.1?

staniek requested changes to this revision.May 9 2020, 9:11 PM
This revision now requires changes to proceed.May 9 2020, 9:11 PM
jfita updated this revision to Diff 83006.May 16 2020, 7:30 PM
jfita edited the summary of this revision. (Show Details)

Updated required version of ECM to use ECMSetupQtPluginMacroNames. It is now
based on master (3.3) instead of the 3.2 branch

This revision was not accepted when it landed; it landed in state Needs Review.May 17 2020, 9:19 PM
This revision was automatically updated to reflect the committed changes.