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

ament_target_dependencies vs target_link_libraries

asked 2020-06-28 23:11:37 -0600

Rufus gravatar image

In the tutorial for adding dependencies, it mentions

Sometimes it will be necessary to call the target_link_libaries CMake function

What are the situations where I should use ament_target_dependencies and when should I use target_link_libraries? I also notice that there are occasions where I need both for the dependencies to be correctly added.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-02-12 05:21:33 -0600

Rufus gravatar image

From my understanding and a bit of experimentation, ament_target_dependencies only works for packages* found using find_package. For packages that aren't coming from find_package, e.g. locally compiled libraries in the same package, you will need to use target_link_libraries. See this question for more details.

* Not sure if it's only for ROS packages found with find_package, or if it works for any package found that way.

edit flag offensive delete link more

Comments

+1 for the finding!

e.g. locally compiled libraries in the same package,

IMO because that's only a target, let alone a package, during the build-time, being find_package incapable makes sense.

130s gravatar image 130s  ( 2023-06-02 11:05:19 -0600 )edit

Question Tools

4 followers

Stats

Asked: 2020-06-28 23:11:37 -0600

Seen: 4,786 times

Last updated: Feb 12 '21