[cmake-developers] [CMake 0015647]: automoc is not run on some files with lots of targets in a CMakeLists.txt

Mantis Bug Tracker mantis at public.kitware.com
Sat Jul 11 15:59:32 EDT 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15647 
====================================================================== 
Reported By:                Friedrich
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15647
Category:                   CMake
Reproducibility:            have not tried
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-07-11 15:59 EDT
Last Modified:              2015-07-11 15:59 EDT
====================================================================== 
Summary:                    automoc is not run on some files with lots of
targets in a CMakeLists.txt
Description: 
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.

Steps to Reproduce: 
(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.


Additional Information: 
See https://mail.kde.org/pipermail/kde-buildsystem/2015-June/010819.html for
related short discussion.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-07-11 15:59 Friedrich      New Issue                                    
======================================================================



More information about the cmake-developers mailing list