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

If the CMakeLists.txt you included is really a copy-paste, then I'm guessing the

 Generate added messages and services with any dependencies listed here

and the

add_dependencies(chap2_example1_a chapter2_tutorials_generate_
messages_cpp)
add_dependencies(chap2_example1_b chapter2_tutorials_generate_
messages_cpp)

lines are confusing CMake (notice the line-breaks).

The first line ("Generate added messages ..") was originally a comment (so either remove it completely or put back the # in front of it), and the other two commands (add_dependencies(..)) should not be broken up into two lines (ie: each add_dependencies(..) should be on a single line).

If the CMakeLists.txt you included is really a copy-paste, then I'm guessing the

 Generate added messages and services with any dependencies listed here

and the

add_dependencies(chap2_example1_a chapter2_tutorials_generate_
messages_cpp)
add_dependencies(chap2_example1_b chapter2_tutorials_generate_
messages_cpp)

lines are confusing CMake (notice the line-breaks).

The first line ("Generate added messages ..") was originally a comment (so either remove it completely or put back the # in front of it), and the other two commands (add_dependencies(..)) should not be broken up into two lines (ie: each add_dependencies(..) should be on a single line).


Edit:

i said that use hapter 2 of the Learning ROS for Robotics Programming book (2nd ed) so my CMAke is a copy paste file. The line "Generate added messages and services with any dependencies listed here" come in book and ROS.org then can't be comment.

The book has probably wrapped some lines to make the CMakeLists.txt fit better in the overal layout of the text. The add_dependencies(..) lines cannot be split like you have it now. They must be a single line each.

As to the "Generate added messages and services with [..]" line: it doesn't matter what the book has there, that line is not a valid CMake command, so has to be removed: either delete it entirely, or make it a comment by prefixing it with a hash (#).

my problem did not solved.

If you changed things in your CMakeLists.txt and it still doesn't work, please update your original question with the adjusted CMakeLists.txt and any (new) errors you get.