[cmake-developers] cmake automoc breaks kde

Stephen Kelly steveire at gmail.com
Tue Nov 29 21:21:05 EST 2011


Alexander Neundorf wrote:

> On Tuesday 22 November 2011, Stephen Kelly wrote:
>> On 11/22/2011 10:03 PM, Alexander Neundorf wrote:
>> >> Now when I try to build the frameworks branch using the cmake next
>> >> branch, I get:
>> >> 
>> >> AUTOMOC: error:
>> >> /home/stephen/dev/src/kf5/tier1/libkcoreaddons/src/io/kdirwatch.cpp:
>> >> The file includes the moc file "kdirwatch_p.moc", which seems to be
>> >> the moc file from a different source file. This is not supported.
>> >> Include "kdirwatch.moc" to run moc on this source file.
>> > 
>> > I added special handling now for the case that basename_p.moc is
>> > included with Qt4.
>> 
>> Your new commits work with the parts of the frameworks branch affected
>> by this, yes.
>> 
>> However, there are still many places where the foo.moc file is expected
>> to be the result of moc'ing the header, which causes errors like this:
>> 
>> 
>> In file included from
>> /home/stephen/dev/build/qt48/kf5/tier1/libkdbus/kdbus_automoc.cpp:2:0:
>> 
/home/stephen/dev/build/qt48/kf5/tier1/libkdbus/moc_kdbusinterprocesslock.c
>> pp: In static member function 'static void
>> KDBusInterProcessLock::qt_static_metacall(QObject*, QMetaObject::Call,
>> int, void**)':
>> 
/home/stephen/dev/build/qt48/kf5/tier1/libkdbus/moc_kdbusinterprocesslock.c
>> pp:55:22: error: invalid use of incomplete type 'struct
>> KDBusInterProcessLockPrivate'
>> 
/home/stephen/dev/build/qt48/kf5/tier1/libkdbus/../../../../../src/kf5/tie
>> r1/libkdbus/kdbusinterprocesslock.h:30:7: error: forward declaration of
>> 'struct KDBusInterProcessLockPrivate'
>> 
>> Fixed by changing the include from foo.moc to moc_foo.cpp of course.
>> 
>> This is due to the use of Q_PRIVATE_SLOT. I've just added a testcase to
>> the branch.
> 
> Please give the current AutomocIncludedDotMocFileHandling branch a try, it
> checks now also for this.

Building solid still fails with the AutomocIncludedDotMocFileHandling 
branch. One of the reasons for failure is including a file with a different 
basename .moc. Fixed in solid with 

-#include "devicenotifier.moc"
+#include "moc_devicenotifier.cpp"

in devicemanager.cpp.

The other failure is building files in subdirectories from a CMakeLists two 
levels up (all the files in the subdirectories are compiled into a single 
library) and including their moc files, which fails.

/home/stephen/dev/src/kf5/tier1/solid/solid/backends/fakehw/fakedevice.cpp:338:42: 
fatal error: backends/fakehw/fakedevice.moc: No such file or directory


Solid builds standalone with Qt 4 in the frameworks branch. You already have 
it in your kdelibs git repo. The easiest thing would be:

git new-workdir kdelibs kdelibs-frameworks frameworks
cd kdelibs-frameworks/tier1/solid
mkdir build && cd build
cmake .. && make 

For convenience I put the current solid source here:

http://www.steveire.com/share/solid.tar.gz

You can decide how much of this should be covered in the backwards guarantee 
automoc feature and how much will require fixing solid instead. I attach the 
patch which fixes solid with cmake AutomocIncludedDotMocFileHandling branch.

Thanks,

Steve.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: solid.patch
Type: text/x-patch
Size: 1389 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20111130/afc216a4/attachment-0002.bin>


More information about the cmake-developers mailing list