MantisBT - CMake
View Issue Details
0013299CMakeCMakepublic2012-06-13 16:062012-08-09 19:38
Stephen Kelly 
Alex Neundorf 
normalminoralways
closedfixed 
 
CMake 2.8.9CMake 2.8.9 
0013299: Build should abort if moc fails
Add a signal which is templated (which causes moc to return an error), and run the unit test. Instead of aborting when moc notifies an error, the build fails later when attempting to include the generated file (using make -j1), as below.

As a failed moc run does not overwrite the target file, an old file can be left behind, causing even the #include to work properly, hiding the bug.
                                                   
Generating private_slot.moc
/home/stephen/dev/src/cmake/Tests/QtAutomoc/private_slot.h:15: Error: Template function as signal or slot
AUTOMOC: error: process for /home/stephen/dev/src/cmake/Tests/QtAutomoc/build/private_slot.moc failed:
/home/stephen/dev/src/cmake/Tests/QtAutomoc/private_slot.h:15: Error: Template function as signal or slot

Generating sub/moc_bar.cpp
Generating moc_xyz.cpp
Generating yaf_p.moc
Generating moc_calwidget.cpp
Generating moc_foo.cpp
returning failed..
[ 28%] Built target foo_automoc
Scanning dependencies of target foo
[ 35%] Building CXX object CMakeFiles/foo.dir/main.cpp.o
[ 42%] Building CXX object CMakeFiles/foo.dir/calwidget.cpp.o
[ 50%] Building CXX object CMakeFiles/foo.dir/foo.cpp.o
[ 57%] Building CXX object CMakeFiles/foo.dir/blub.cpp.o
[ 64%] Building CXX object CMakeFiles/foo.dir/bar.cpp.o
[ 71%] Building CXX object CMakeFiles/foo.dir/abc.cpp.o
[ 78%] Building CXX object CMakeFiles/foo.dir/xyz.cpp.o
[ 85%] Building CXX object CMakeFiles/foo.dir/yaf.cpp.o
[ 92%] Building CXX object CMakeFiles/foo.dir/private_slot.cpp.o
/home/stephen/dev/src/cmake/Tests/QtAutomoc/private_slot.cpp:21:28: fatal error: private_slot.moc: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/foo.dir/private_slot.cpp.o] Error 1
make[1]: *** [CMakeFiles/foo.dir/all] Error 2
make: *** [all] Error 2
makeobj[0]: Leaving directory `/home/stephen/dev/src/cmake/Tests/QtAutomoc/build'
Qt( 4.8 ) KDE ( )
stephen@hal:~/dev/src/cmake/Tests/QtAutomoc/build{master}$ git diff
diff --git a/Tests/QtAutomoc/private_slot.h b/Tests/QtAutomoc/private_slot.h
index 28e5448..b5177e3 100644
--- a/Tests/QtAutomoc/private_slot.h
+++ b/Tests/QtAutomoc/private_slot.h
@@ -12,6 +12,9 @@ class PrivateSlot : public QObject
 public:
   PrivateSlot(QObject *parent = 0);
 
+signals:
+ template<int> void someSignal();
+
 private:
   PrivateSlotPrivate * const d;
   Q_PRIVATE_SLOT(d, void privateSlot())
No tags attached.
Issue History
2012-06-13 16:06Stephen KellyNew Issue
2012-06-13 16:11Alex NeundorfAssigned To => Alex Neundorf
2012-06-13 16:11Alex NeundorfStatusnew => assigned
2012-06-13 17:32Rolf Eike BeerNote Added: 0029690
2012-06-14 16:30Alex NeundorfNote Added: 0029696
2012-06-14 16:30Alex NeundorfStatusassigned => closed
2012-06-14 16:30Alex NeundorfResolutionopen => fixed
2012-06-14 16:30Alex NeundorfDescription Updatedbug_revision_view_page.php?rev_id=678#r678
2012-08-09 19:38David ColeFixed in Version => CMake 2.8.9
2012-08-09 19:38David ColeTarget Version => CMake 2.8.9

Notes
(0029690)
Rolf Eike Beer   
2012-06-13 17:32   
Yes please! I've seen the very same thing today in a totally unrelated project, too.
(0029696)
Alex Neundorf   
2012-06-14 16:30   
Merged e4a2d5f automoc: better error handling (0013299) into next, it should be better now.