View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014159CMakeCMakepublic2013-05-21 11:302014-06-02 08:37
ReporterJanne Rönkkö 
Assigned ToStephen Kelly 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformLinuxOSArchlinuxOS Version
Product VersionCMake 2.8.10.2 
Target VersionFixed in VersionCMake 2.8.11 
Summary0014159: qt4_wrap_cpp Creates Incorrect Dependencies When Ninja Generator Is Used
DescriptionWhen using Ninja as generator qt4_wrap_cpp function generates incorrect dependencies causing all the wrapped source files to be rebuilt when any of the source is changed.

Due to extra dependencies the build with Ninja is much slower than it should be.
Steps To ReproduceExtract the example.tar to get example project and in the build directory run
cmake .. -G Ninja
ninja -v
touch ../A.hpp
ninja -v

Also B.cpp and B_moc.cxx are build even though those files do not depend on A.hpp.
Additional InformationWith GNUMake B.cpp and B_moc.cxx is not recompiled after modifying (touching) A.hpp:

.../cmake-qt-moc-bug/build $ cmake .. -G 'Unix Makefiles'
-- The C compiler identification is GNU 4.8.0
-- The CXX compiler identification is GNU 4.8.0
# ... snip ...
-- Found Qt4: /usr/bin/qmake-qt4 (found version "4.8.4")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/janne/tmp/cmake-qt-moc-bug/build
.../cmake-qt-moc-bug/build $ make
[ 16%] Generating moc_B.cxx
[ 33%] Generating moc_A.cxx
Scanning dependencies of target mylib
[ 50%] Building CXX object CMakeFiles/mylib.dir/A.cpp.o
[ 66%] Building CXX object CMakeFiles/mylib.dir/B.cpp.o
[ 83%] Building CXX object CMakeFiles/mylib.dir/moc_A.cxx.o
[100%] Building CXX object CMakeFiles/mylib.dir/moc_B.cxx.o
Linking CXX static library libmylib.a
[100%] Built target mylib
.../cmake-qt-moc-bug/build $ touch ../A.hpp
.../cmake-qt-moc-bug/build $ make
[ 16%] Generating moc_A.cxx
Scanning dependencies of target mylib
[ 33%] Building CXX object CMakeFiles/mylib.dir/A.cpp.o
[ 50%] Building CXX object CMakeFiles/mylib.dir/moc_A.cxx.o
Linking CXX static library libmylib.a
[100%] Built target mylib


But with Ninja also B.cpp and B_moc.cpp are rebuilt:

janne@kafir ~/tmp/cmake-qt-moc-bug/build $ cmake .. -G Ninja
-- The C compiler identification is GNU 4.8.0
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- works
# ... snip ...
-- Found Qt4: /usr/bin/qmake-qt4 (found version "4.8.4")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/janne/tmp/cmake-qt-moc-bug/build
.../cmake-qt-moc-bug/build $ ninja -v
[1/7] cd /home/janne/tmp/cmake-qt-moc-bug/build && /usr/lib/qt4/bin/moc -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -o /home/janne/tmp/cmake-qt-moc-bug/build/moc_B.cxx /home/janne/tmp/cmake-qt-moc-bug/B.hpp
[2/7] cd /home/janne/tmp/cmake-qt-moc-bug/build && /usr/lib/qt4/bin/moc -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -o /home/janne/tmp/cmake-qt-moc-bug/build/moc_A.cxx /home/janne/tmp/cmake-qt-moc-bug/A.hpp
[3/7] /usr/lib/colorgcc/bin/c++ -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -MMD -MT CMakeFiles/mylib.dir/A.cpp.o -MF "CMakeFiles/mylib.dir/A.cpp.o.d" -o CMakeFiles/mylib.dir/A.cpp.o -c ../A.cpp
[4/7] /usr/lib/colorgcc/bin/c++ -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -MMD -MT CMakeFiles/mylib.dir/B.cpp.o -MF "CMakeFiles/mylib.dir/B.cpp.o.d" -o CMakeFiles/mylib.dir/B.cpp.o -c ../B.cpp
[5/7] /usr/lib/colorgcc/bin/c++ -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -MMD -MT CMakeFiles/mylib.dir/moc_A.cxx.o -MF "CMakeFiles/mylib.dir/moc_A.cxx.o.d" -o CMakeFiles/mylib.dir/moc_A.cxx.o -c moc_A.cxx
[6/7] /usr/lib/colorgcc/bin/c++ -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -MMD -MT CMakeFiles/mylib.dir/moc_B.cxx.o -MF "CMakeFiles/mylib.dir/moc_B.cxx.o.d" -o CMakeFiles/mylib.dir/moc_B.cxx.o -c moc_B.cxx
[7/7] : && /usr/bin/cmake -E remove libmylib.a && /usr/bin/ar cr libmylib.a CMakeFiles/mylib.dir/A.cpp.o CMakeFiles/mylib.dir/B.cpp.o CMakeFiles/mylib.dir/moc_A.cxx.o CMakeFiles/mylib.dir/moc_B.cxx.o && /usr/bin/ranlib libmylib.a && :

.../cmake-qt-moc-bug/build $ touch ../A.hpp
.../cmake-qt-moc-bug/build $ ninja -v
[1/6] cd /home/janne/tmp/cmake-qt-moc-bug/build && /usr/lib/qt4/bin/moc -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -o /home/janne/tmp/cmake-qt-moc-bug/build/moc_A.cxx /home/janne/tmp/cmake-qt-moc-bug/A.hpp
[2/6] /usr/lib/colorgcc/bin/c++ -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -MMD -MT CMakeFiles/mylib.dir/A.cpp.o -MF "CMakeFiles/mylib.dir/A.cpp.o.d" -o CMakeFiles/mylib.dir/A.cpp.o -c ../A.cpp
[3/6] /usr/lib/colorgcc/bin/c++ -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -MMD -MT CMakeFiles/mylib.dir/B.cpp.o -MF "CMakeFiles/mylib.dir/B.cpp.o.d" -o CMakeFiles/mylib.dir/B.cpp.o -c ../B.cpp
[4/6] /usr/lib/colorgcc/bin/c++ -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -MMD -MT CMakeFiles/mylib.dir/moc_A.cxx.o -MF "CMakeFiles/mylib.dir/moc_A.cxx.o.d" -o CMakeFiles/mylib.dir/moc_A.cxx.o -c moc_A.cxx
[5/6] /usr/lib/colorgcc/bin/c++ -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -MMD -MT CMakeFiles/mylib.dir/moc_B.cxx.o -MF "CMakeFiles/mylib.dir/moc_B.cxx.o.d" -o CMakeFiles/mylib.dir/moc_B.cxx.o -c moc_B.cxx
[6/6] : && /usr/bin/cmake -E remove libmylib.a && /usr/bin/ar cr libmylib.a CMakeFiles/mylib.dir/A.cpp.o CMakeFiles/mylib.dir/B.cpp.o CMakeFiles/mylib.dir/moc_A.cxx.o CMakeFiles/mylib.dir/moc_B.cxx.o && /usr/bin/ranlib libmylib.a && :
TagsNo tags attached.
Attached Filestar file icon example.tar [^] (10,240 bytes) 2013-05-21 11:30

 Relationships

  Notes
(0033118)
Janne Rönkkö (reporter)
2013-05-23 01:44

Seems to be working in 2.8.11
(0035982)
Robert Maynard (manager)
2014-06-02 08:37

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2013-05-21 11:30 Janne Rönkkö New Issue
2013-05-21 11:30 Janne Rönkkö File Added: example.tar
2013-05-23 01:44 Janne Rönkkö Note Added: 0033118
2013-11-02 09:25 Stephen Kelly Status new => resolved
2013-11-02 09:25 Stephen Kelly Fixed in Version => CMake 2.8.11
2013-11-02 09:25 Stephen Kelly Resolution open => fixed
2013-11-02 09:25 Stephen Kelly Assigned To => Stephen Kelly
2014-06-02 08:37 Robert Maynard Note Added: 0035982
2014-06-02 08:37 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team