Ask Your Question
0

Update package depencies

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

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
2

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

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

Comments

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 imageBlupon ( 2017-07-24 04:11:24 -0600 )edit
1

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 imagegvdhoorn ( 2017-07-24 04:17:44 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 38 times

Last updated: Jul 12 '17