ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The qt_create script by default sets up a package for development of a single binary (keeps it simple).

The easiest way to get around it is to simply create two different packages. Or if you want to share some code between the two, one library package and two binary packages that depend on the library package.

I don't know how complicated your source structure setup, but the cmake you probably want to look at is the line in CMakeLists.txt:

file(GLOB_RECURSE QT_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS src/*.cpp)

That one assigns all the .cpp files under the src directory to QT_SOURCES and uses them to build the qt program. It's collecting the sources for both your mains together. Instead of globbing for sources, just comment that and assign sources manually. e.g.

set(QT_SOURCES src/main.cpp src/qnode.cpp src/main_window.cpp)
set(OTHER_SOURCES src/other_main.cpp)
rosbuild_add_executable(qfoo ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP})
rosbuild_add_executable(foo ${OTHER_SOURCES}) # non qt node

If you don't mind really learning the cmake though - check the qt_tutorials package for a complicated example of combining a build of a library and several nodes in the one package.