[cmake-developers] Current deficiencies of automoc

Tobias Hunger tobias.hunger at gmail.com
Thu Oct 20 15:17:30 EDT 2016


Hi!

Am 20.10.2016 21:08 schrieb "Brad King" <brad.king at kitware.com>:
> On 10/20/2016 02:30 PM, Alan W. Irwin wrote:
> > To be specific here is the way I believe automoc should work.  If
> >
> > #include "moc_<name>.cpp"
> >
> > is found in a source file under automoc
> > control, then if moc_<name>.cpp could not be found in any of the
> > include directories for the target, then search those include
> > directories (including source-tree equivalents of build-tree include
> > directories) for <name>.h, run moc on that file and place the result
> > moc_<name>.cpp in the build directory corresponding to <name.h>.
> [snip]
> > this is a plea to the CMake developers to fix the above deficiency

If you include moc_name.cpp, then you need to run moc on this *source*
file. That is what allows you to have private classes in your source file
that derive from QObject.

The headers should be covered by automoc automatically: Any header
containing a Q_OBJECT macro should be moc-ed. So there should not be any
need to include moc_*.cpp files in source files for any header.

At least that is how I always use this with qmake, but I am hardly an
expert on how moc should work:-)

Best Regards,
Tobias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20161020/abad9447/attachment.html>


More information about the cmake-developers mailing list