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

Revision history [back]

Hello,

You should have added those three lines after find_package(). The order does matter in CMakeLists.txt. Please see wiki/catkin - CMakeLists.txt - Overall Structure and Ordering.

I think your package does not contain any messages/services/actions files so you don't really need

add_dependencies(name_of_node_chatter my_package_generate_messages_cpp)

If you do, you need to add generate_messages(DEPENDENCIES ...). The message generation targets are created by generate_messages(DEPENDENCIES ...). Using add_dependencies(name_of_node_chatter my_package_generate_messages_cpp) is to ensure that my_package_generate_messages_cpp is built before the name_of_node_chatter target.

If your target depends on other messages/services/actions from other packages, even though your package doesn't build any messages/services/actions at compile time, you should add

add_dependencies(some_target ${catkin_EXPORTED_TARGETS})

More details about add_dependencies(...) can be found here.

I think it's always safe to add a dependency on catkin_EXPORTED_TARGETS.

Hello,

You should have added those three lines after find_package(). The order does matter in CMakeLists.txt. Please see wiki/catkin - CMakeLists.txt - Overall Structure and Ordering.

I think your package does not contain any messages/services/actions files so you don't really need

add_dependencies(name_of_node_chatter my_package_generate_messages_cpp)

If you do, you need to add generate_messages(DEPENDENCIES ...). The message generation targets are created by generate_messages(DEPENDENCIES ...). Using add_dependencies(name_of_node_chatter my_package_generate_messages_cpp) is to ensure that my_package_generate_messages_cpp is built before the name_of_node_chatter target.

If your target depends on other messages/services/actions from other packages, even though your package doesn't build any messages/services/actions at compile time, you should add

add_dependencies(some_target add_dependencies(name_of_node_chatter ${catkin_EXPORTED_TARGETS})

More details about add_dependencies(...) can be found here.

I think it's always safe to add a dependency on catkin_EXPORTED_TARGETS.