MantisBT - CMake
View Issue Details
0011884CMake(No Category)public2011-02-21 10:212011-09-05 11:37
Stephen Kelly 
Clinton Stimpson 
normalminorhave not tried
closednot fixable 
 
 
0011884: The target of qt4_add_dbus_interface should automatically depend on its generation.
If you use qt4_generate_dbus_interface() to generate an xml file, you may have a qt4_add_dbus_interfaces() within the same project to consume the dbus interface. In that case you must ensure that the xml file is generated before they are consumed.

You can do that by creating a custom target which encapsulates the dependencies.

macro(my_generate_dbus_interface _header _customName )
  qt4_generate_dbus_interface(${_header} ${_customName} ${ARGN} )
  add_custom_target(xml_target_${_header} DEPENDS ${_customName})
  add_dependencies(dbus_interfaces_xml xml_target_${_header} )
endmacro()

Then use my_generate_dbus_interface instead of qt4_generate_dbus_interface.

However, this should not be necessary. qt4_add_dbus_interfaces could depend on the xml file existing. Or maybe there's an even better solution.
No tags attached.
gz cmake_dbus.tar.gz (83,306) 2011-04-05 09:35
https://public.kitware.com/Bug/file/3801/cmake_dbus.tar.gz
Issue History
2011-02-21 10:21Stephen KellyNew Issue
2011-02-22 17:22Brad KingAssigned To => Clinton Stimpson
2011-02-22 17:22Brad KingStatusnew => assigned
2011-04-04 22:47Clinton StimpsonNote Added: 0026092
2011-04-05 09:35Stephen KellyNote Added: 0026094
2011-04-05 09:35Stephen KellyFile Added: cmake_dbus.tar.gz
2011-04-05 12:22Clinton StimpsonNote Added: 0026096
2011-04-05 13:18Clinton StimpsonNote Added: 0026097
2011-04-05 13:18Clinton StimpsonStatusassigned => resolved
2011-04-05 13:18Clinton StimpsonResolutionopen => not fixable
2011-09-05 11:37David ColeStatusresolved => closed
2011-09-05 11:37David ColeNote Added: 0027343

Notes
(0026092)
Clinton Stimpson   
2011-04-04 22:47   
Do you have an example that demonstrates the problem?
(0026094)
Stephen Kelly   
2011-04-05 09:35   
See the attached. I have to build it twice because the xml file is not generated by the master build process before the slave build process attempts to use it.


 

kde-devel@bishop:~/dev/src/playground/qml_dbus/orig/qml_dbus/build$ cmake ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/lib/icecc/bin/gcc
-- Check for working C compiler: /usr/lib/icecc/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/lib/icecc/bin/c++
-- Check for working CXX compiler: /usr/lib/icecc/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found.
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found.
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found.
-- Found Qt-Version 4.7.1 (using /home/kde-devel/dev/qt47/bin/qmake)
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so - found
-- Looking for gethostbyname
m-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
a-- Looking for remove - found
-- Looking for shmat
k-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/libX11.so
-- Looking for include files CMAKE_HAVE_PTHREAD_H
e-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads

-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Looking for _POSIX_TIMERS
-- Looking for _POSIX_TIMERS - found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kde-devel/dev/src/playground/qml_dbus/orig/qml_dbus/build
Qt( 4.7 ) KDE ( 4.6 )
kde-devel@bishop:~/dev/src/playground/qml_dbus/orig/qml_dbus/build$ make
makeobj[0]: Entering directory `/home/kde-devel/dev/src/playground/qml_dbus/orig/qml_dbus/build'
make[2]: *** No rule to make target `com.kdab.DynamicName.xml', needed by `slave/dynamicnameinterface.cpp'. Stop.
make[1]: *** [slave/CMakeFiles/slave_app.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 7%] Generating dynamicname.moc
[ 15%] Generating ../com.kdab.DynamicName.xml
[ 23%] Generating dynamicnameadaptor.cpp, dynamicnameadaptor.h
[ 30%] Generating dynamicnameadaptor.moc
Scanning dependencies of target master_app
[ 38%] [ 46%] [ 53%] Building CXX object master/CMakeFiles/master_app.dir/master.cpp.o
Building CXX object master/CMakeFiles/master_app.dir/dynamicnameadaptor.cpp.o
Building CXX object master/CMakeFiles/master_app.dir/dynamicname.cpp.o
Linking CXX executable ../master_app
[ 53%] Built target master_app
make: *** [all] Error 2
makeobj[0]: Leaving directory `/home/kde-devel/dev/src/playground/qml_dbus/orig/qml_dbus/build'
Qt( 4.7 ) KDE ( 4.6 )
kde-devel@bishop:~/dev/src/playground/qml_dbus/orig/qml_dbus/build$ make
makeobj[0]: Entering directory `/home/kde-devel/dev/src/playground/qml_dbus/orig/qml_dbus/build'
[ 7%] [ 15%] Generating dynamicnameinterface.cpp, dynamicnameinterface.h
Generating dynamicnameproxy.moc
[ 23%] [ 76%] Built target master_app
Generating dynamicnameinterface.moc
Scanning dependencies of target slave_app
[ 84%] [ 92%] [100%] Building CXX object slave/CMakeFiles/slave_app.dir/dynamicnameproxy.cpp.o
Building CXX object slave/CMakeFiles/slave_app.dir/slave.cpp.o
Building CXX object slave/CMakeFiles/slave_app.dir/dynamicnameinterface.cpp.o
Linking CXX executable ../slave_app
[100%] Built target slave_app
makeobj[0]: Leaving directory `/home/kde-devel/dev/src/playground/qml_dbus/orig/qml_dbus/build'
Qt( 4.7 ) KDE ( 4.6 )
kde-devel@bishop:~/dev/src/playground/qml_dbus/orig/qml_dbus/build$
(0026096)
Clinton Stimpson   
2011-04-05 12:22   
I've noticed that if you combine slave and master CMakeLists.txt files into one CMakeLists.txt file, the problem goes away.
Looks like an issue related core cmake functionality.

add_custom_target() or target level dependencies is something you can do, but not something FindQt4.cmake can do for you.

I'll ask on the CMake list what should happen.
(0026097)
Clinton Stimpson   
2011-04-05 13:18   
Not fixable in the scope of the Qt4 macros. The user of those macros has to deal with it.

See: http://www.cmake.org/pipermail/cmake/2011-April/043764.html [^]
(0027343)
David Cole   
2011-09-05 11:37   
Closing resolved issues that have not been updated in more than 4 months.