Stephen Kelly wrote:

> but sometimes I
> still get build failures due to the dbus xml stuff that I haven't 
tracked
> down and which are resolved on the next build.
> 

I think this is because I was missing some 

add_dependencies(foo dbus_interfaces_xml)

in my app, so hopefully that's resolved for me now.

Nevertheless, if this can't be fixed in CMake, the fix should be 
documented. The fix for the example in the bug report is attached.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c60bc16..633699e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,6 +17,10 @@ include(${QT_USE_FILE})
 
 set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
 
+add_custom_target(dbus_interfaces_xml ALL
+  COMMENT "Helper target for XML stuff. The other apps and xml generations depend on it."
+)
+
 add_subdirectory(master)
 add_subdirectory(slave)
 
diff --git a/cmake/CustomMacros.cmake b/cmake/CustomMacros.cmake
new file mode 100644
index 0000000..3e0f8ca
--- /dev/null
+++ b/cmake/CustomMacros.cmake
@@ -0,0 +1,7 @@
+
+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()
+
diff --git a/master/CMakeLists.txt b/master/CMakeLists.txt
index f147a41..0b3ba2c 100644
--- a/master/CMakeLists.txt
+++ b/master/CMakeLists.txt
@@ -10,9 +10,11 @@ include_directories(
   ${PROJECT_BINARY_DIR}
 )
 
+include(CustomMacros)
+
 qt4_automoc(qml_dbus_master_moc_srcs ${qml_dbus_master_srcs})
 
-qt4_generate_dbus_interface(dynamicname.h ${CMAKE_BINARY_DIR}/com.kdab.DynamicName.xml)
+my_generate_dbus_interface(dynamicname.h ${CMAKE_BINARY_DIR}/com.kdab.DynamicName.xml)
 
 qt4_add_dbus_adaptor(qml_dbus_master_srcs
   ${CMAKE_BINARY_DIR}/com.kdab.DynamicName.xml
@@ -27,3 +29,4 @@ target_link_libraries(master_app
   ${QT_QTDBUS_LIBRARIES}
 )
 
+add_dependencies(master_app dbus_interfaces_xml)
diff --git a/slave/CMakeLists.txt b/slave/CMakeLists.txt
index c766563..c0e175d 100644
--- a/slave/CMakeLists.txt
+++ b/slave/CMakeLists.txt
@@ -24,3 +24,5 @@ target_link_libraries(slave_app
   ${QT_QTDECLARATIVE_LIBRARIES}
   ${QT_QTGUI_LIBRARIES}
 )
+
+add_dependencies(slave_app dbus_interfaces_xml)

_______________________________________________
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://www.cmake.org/mailman/listinfo/cmake

Reply via email to