MantisBT - CMake
View Issue Details
0015647CMakeCMakepublic2015-07-11 15:592016-06-10 14:31
Friedrich 
Kitware Robot 
normalmajorhave not tried
closedmoved 
CMake 3.2.3 
 
0015647: automoc is not run on some files with lots of targets in a CMakeLists.txt
CMake at least in the versions 3.1.3-3.2.3 for some not yet known reasons fails to run automoc on random targets if there are a lot of targets in a file. It's random as in, changing target names has an effect on with which files of which target automoc fails to be run (e.g. appending another letter to the name suddenly makes it work, just to fail on files of another target, and then the game restarts).

With 3.3.0-rc2 the problem was not seen.
(Sorry, had no time to create a small example)

The problem can be seen in the build of the KDE project "Calligra" in the "frameworks" branch. The CMakeLists.txt file where things are screwed up is "krita/image/tests/CMakeLists.txt", http://quickgit.kde.org/?p=calligra.git&a=blob&h=c0f2c77373fb1b624296d27e66c2deb3c86b6c07&hb=0629fef375cfc5520cab57a3920e88fe84526c94&f=krita%2Fimage%2Ftests%2FCMakeLists.txt [^]

It's enough to build the Krita part of Calligra to trigger this:
    # get Calligra sources, use frameworks branch
    # (sadly no way known to directly get a tarball with a snapshot)
    git clone git://anongit.kde.org/calligra.git [^]
    cd calligra; git checkout frameworks; cd ..

Use an texteditor of your choice and remove the cmake version check at the beging of "krita/image/tests/CMakeLists.txt". Then go on:

    # create build dir and run cmake, reduce to just building krita (+ internal deps)
    mkdir build; cd build
    cmake ../calligra -DBUILD_TESTING=ON -DPRODUCTSET=KRITA
If at the end of the configure log you see
    -- ------ The following product(set)s/features will be built ---------
    -- KRITA: Full Krita
we are good to finally test the problem.
    cd krita/image/tests/
    make

And now wait for the build to fail, it should be something like

CMakeFiles/KisAsyncMergerTest.dir/kis_async_merger_test.cpp.o: In function
`KisAsyncMergerTest::KisAsyncMergerTest()':
/home/jenkins/builds/calligra/kf5-
qt5/krita/image/tests/kis_async_merger_test.h:24: undefined reference to
`vtable for KisAsyncMergerTest'
CMakeFiles/KisAsyncMergerTest.dir/kis_async_merger_test.cpp.o: In function
`KisAsyncMergerTest::~KisAsyncMergerTest()':
/home/jenkins/builds/calligra/kf5-
qt5/krita/image/tests/kis_async_merger_test.h:24: undefined reference to
`vtable for KisAsyncMergerTest'
collect2: error: ld returned 1 exit status
krita/image/tests/CMakeFiles/KisAsyncMergerTest.dir/build.make:89: recipe for
target 'krita/image/tests/KisAsyncMergerTest' failed

Give kis_async_merger_test.{h,cpp} a good look, but it seems fine, Q_OBJECT exists and whatever is needed that should trigger automoc (and does for all the other files around and with other cmake versions).
Now in "krita/image/tests/CMakeLists.txt" change the target name "KisAsyncMergerTest" to e.g. "KisAsyncMergerTestA" and rerun the build.
Suddenly automoc is run on "kis_async_merger_test.h"... only to fail on the next.
See https://mail.kde.org/pipermail/kde-buildsystem/2015-June/010819.html [^] for related short discussion.
No tags attached.
Issue History
2015-07-11 15:59FriedrichNew Issue
2016-06-10 14:29Kitware RobotNote Added: 0042806
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0042806)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.