[cmake-developers] Was AUTOMOC designed to run for each build?

Alexander Neundorf neundorf at kde.org
Fri Sep 26 16:04:23 EDT 2014


On Friday, September 26, 2014 01:53:35 Stephen Kelly wrote:
> Alexander Neundorf wrote:
> >> I don't see why the target is executed each time, but is it that way by
> >> design?
> > 
> > iirc, yes.
> > The moc files have to be generated before any of the source files is
> > compiled, so automoc is in a target the actual target depends on.
> > IIRC it is exclude_from_all so that it is only built when the actual
> > target is built.
> > Do you think it should only rerun if any of the source files has changed ?
> > There was some problem with this.
> > The headers are usually not part of the listed source files.
> 
> Hmm, well, we do know which header is relevant right? Because it's the one
> (or many) we set up commands to run moc on. Maybe we only know the relevant
> headers too late (at the time of running the -E cmake_autogen command, not
> at cmake time)?
> 
> Something else I've wondered is why the parsing of the files is done
> 'delayed' with the -E cmake_autogen command. Is it just to avoid doing that
> task during cmake time (because it's time consuming), and to allow
> parallelization?

it can't be done at cmake time, because editing a cpp file and inserting 
#include "foo.moc" does not cause cmake to rerun, so the parsing must happen 
during buildtime.

Alex




More information about the cmake-developers mailing list