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

Update package depencies

asked 2017-07-12 10:18:19 -0500

Blupon gravatar image

Hi !

I was reading this tutorial on how to add dependencies to a package, and was wondering why one would "only" need to upgrade the package.xml and not the CMakeLists.txt, where the dependencies initially given at the creation of the package can be read, in the find_package() section?

I thought catkin_make in the ~/catkin_ws would update the CMakeLists.txt according to the package.xml content, but after trying it is doesn't react as I expected it would.

Thanks & sorry if I missed that info somewhere !

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2017-07-12 10:29:24 -0500

gvdhoorn gravatar image

There is some nuance here.

Yes, the CMakeLists.txt will need to be updated if you add system dependences to your package.xml, but only if that dependency is actually used at build time (and if it's actually C++ (or some other compiled language) we're targeting).

So if a dependency does not provide headers or libraries, or some other artefact or piece of build infrastructure (like preprocessors, code generators, etc), CMakeList.txt would probably not need to be updated.

Having said that: the example shown on the page you linked to would seem to be a case where CMakeLists.txt would need to be updated -- assuming obviously that the dependency (ie: headers, libraries) are used by any of the C++ sources that are being build.

edit flag offensive delete link more


for example: to add depency of a package to tf sensor_msgs std_msgs to publish a jointState (like seen on this tutorial), do I need to edit the CMakeLists.txt ? Build infrastructure is new to me ^^

Blupon gravatar image Blupon  ( 2017-07-24 04:11:24 -0500 )edit

Yes. Whenever you use something 'new' in your code -- and that 'something' is not something that is local to your own pkg, you'll need to add it to your manifest and update the CMakeLists.txt.

Note that this is not ROS specific. The same would be needed in a regular CMake project.

gvdhoorn gravatar image gvdhoorn  ( 2017-07-24 04:17:44 -0500 )edit

Question Tools

1 follower


Asked: 2017-07-12 10:18:19 -0500

Seen: 198 times

Last updated: Jul 12 '17