[cmake-developers] Automoc in cmake

Alexander Neundorf neundorf at kde.org
Wed Jun 8 14:59:36 EDT 2011


On Monday, June 06, 2011 03:37:16 PM Brad King wrote:
> On 06/06/2011 03:56 AM, Alexander Neundorf wrote:
> > On Saturday, June 04, 2011 10:24:52 AM Alexander Neundorf wrote:
> >> Hi,
> >> 
> >> one feature which all KDE developers are used to and which is also used
> >> by qmake when building Qt is "automoc".
> >> 
> >> This means that you don't have to write
> >> qt4_wrap_cpp(srcs ${filesToBeMoced})
> >> 
> >> but instead you simply do
> >> kde4_add_executable(hello ${srcs})
> >> and everything including moc is handled automatically.
> 
> I agree with Nico's response that this is too specific to integrate into
> CMake itself.  That level of automagic processing puts too much inside
> the add_executable and add_library commands.  This kind of customization
> belongs in macros.
> 
> > Yesterday we finished porting our automoc away from Qt to pure STL/cmsys.
> > It is now a small executable of 300kb and linking to nothing special.
> > It is also BSD-licensed.
> 
> Great!  I suggest you package this in a distribution that provides the
> executable and CMake macros to use it:

That's already the current state, and developers are not happy with it.
They don't know about it or adding yet another dependency to the build is a 
problem for them, e.g. due to strict policies at work.

I do not make this up, people come to me and complain that cmake doesn't do 
it.
Everybody I talked to who is used to automoc from KDE or from qmake wants to 
have it available directly in cmake.

Even the one Gnome guy who was in Randa was not happy with cmake for some Qt 
projects he had because it didn't do automoc. So he felt cmake is too 
complicated and stayed with qmake.
The same for about every KDE developer, i.e. hundreds.

We (me, you, Bill, Matthias Kretz,  Andreas Hartmetz) talked about this 
before, in march 2008. In a mail from March 18, 2008, you write:

--------------8<----------------8<------------------8<---------------------

Alexander Neundorf wrote:
> in kdelibs we have a tool "automoc", which is used to handle the moc files  
> of  Qt automatically, i.e. it parses the source files for Q_OBJECT etc. and
> runs moc as required.
> It is written using Qt 4 (QtCore only AFAIK).
> In order to make this usable also for Qt-only applications we (KDE) would 
> like to move automoc out of kdelibs, the first step would be a separate svn 
> module, or ideally directly into cmake.

Adding automoc would be a great motivation for people to use CMake for
Qt-based stuff.

...

> If those two things were met, would you accept it in cmake cvs as an 
> additional tool or maybe also as a built-in command line command (as -E copy 
> etc.) ?

If it is not too much code I'm not against accepting it.  Bill?
...

-Brad
--------------8<----------------8<------------------8<---------------------

The "two things" are 
- BSD licensing,  we did that 3 years ago: 
http://quickgit.kde.org/?p=automoc.git&a=commit&h=78fdba1e2d96bc45512531748ffb770cb1124798  
-and porting to STL+cmsys, we did that now

Beside that, I didn't ask explicitely, but I'm sure without automoc cmake is 
out of the game for becoming the buildsystem for Qt5 (because in Qt4 they do 
automoc in qmake).

Alex



More information about the cmake-developers mailing list