Removing non-required moc includes

Alexander Neundorf neundorf at kde.org
Mon Jan 23 20:41:57 UTC 2012


On Monday 23 January 2012, Andras Mantia wrote:
> On Monday, January 23, 2012 09:39:07 Stephen Kelly wrote:
> > Hi,
> > 
> > I wrote a script to remove most of the moc includes from kdelibs
> 
> I probably missed something, but why remove them? Wouldn't that mean slower
> compilation?
> 
> > and
> > transform the remaining ones from incorrect to correct form (usually from
> > #include "foo.moc" to #include "moc_foo.cpp").
> 
> Does the built-in automoc not support the "foo.moc" includes?
> It'd be a pitty, imo it is much nicer then moc_foo.cpp.

Simple and clear rules:
#include "moc_foo.cpp" -> moc the header
#include "foo.moc" -> moc the cpp file

This is qmake compatible.
That you say "foo.moc" is nicer than "moc_foo.cpp" doesn't count as argument 
;-)

http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:AUTOMOC

For more compatiblity, see the CMAKE_AUTOMOC_RELAXED_MODE variable:
http://www.cmake.org/cmake/help/cmake-2-8-
docs.html#variable:CMAKE_AUTOMOC_RELAXED_MODE

Alex


More information about the Kde-buildsystem mailing list