On Thursday 09 June 2011, Alexander Neundorf wrote:
...
> At build time, the logic is complex enough and it also has to be really
> fast so that this should IMO be done in the C++.
> It could either be a -E automoc <infofile> option, or a -P
> CMakeAutomoc.cmake script, which then calls a new automoc() function.
> This then needs to go through the list of source files, and if the file is
> newer than the associated stamp-file or if no stamp-file exists, it needs
> to parse the source file for a #include-moc statement,

It does even more that that. Some comments from the implementation:

// the program goes through all .cpp files to see which moc files are
// included. It is not really interesting how the moc file is named, but what
// file the moc is created from. Once a moc is included the same moc may not
// be included in the _automoc.cpp file anymore. OTOH if there's a
// header containing Q_OBJECT where no corresponding moc file is included
// anywhere a moc_<filename>.cpp file is created and included in the
// _automoc.cpp file.
...

// If the moc include is of the moc_foo.cpp style we expect the Q_OBJECT class
// declaration in a header file.
// If the moc include is of the foo.moc style we need to look for a Q_OBJECT
// macro in the current source file, if it contains the macro we generate the
// moc file from the source file, else from the header.

Alex
_______________________________________________
cmake-developers mailing list
cmake-developers@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to