The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14159 
====================================================================== 
Reported By:                Janne Rönkkö
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14159
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-05-21 11:30 EDT
Last Modified:              2013-05-21 11:30 EDT
====================================================================== 
Summary:                    qt4_wrap_cpp Creates Incorrect Dependencies When
Ninja Generator Is Used
Description: 
When 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 Reproduce: 
Extract 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 Information: 
With 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 && :

====================================================================== 

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                      
======================================================================

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to