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

Redundancy in find_package(COMPONENTS) and catkin_package(CATKIN_DEPENDS)?

asked 2019-05-09 20:28:48 -0500

KenYN gravatar image

As I'm debugging an error with .so dependencies, I've began to wonder about find_package() and catkin_package(). On the Wiki here it says:

# Get the information about this package's buildtime dependencies
find_package(catkin REQUIRED
    COMPONENTS message_generation std_msgs sensor_msgs)

## snip

# Declare that this catkin package's runtime dependencies
catkin_package(
   CATKIN_DEPENDS message_runtime std_msgs sensor_msgs)

OK, so it's compile-time versus run-time dependencies. However, if I look at the auto-generated help here it says:

  • CATKIN_DEPENDS (list of strings) – a list of catkin projects which this project depends on. It is used when client code finds this project via find_package() or pkg-config. Each project listed will in turn be find_package-ed or is states as Requires in the .pc file. Therefore their INCLUDE_DIRS and LIBRARIES will be appended to ours. Only catkin projects should be used where it be guarantee that they are find_packagable and have pkg-config files.

Now this says "Each project listed will in turn be find_package-ed", so it implies that catkin_package() does a second find_package() as the find_package(catkin COMPONENTS), according to the documentation already does:

Instead of using find_package on those packages, if you specify them as components, it will make life easier.

So, what actually is the definitive description of what they do?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2019-05-15 18:49:28 -0500

Dirk Thomas gravatar image

The find_package call in your snippet happens when this package (calling it pkg_foo) is being build. So these are build dependencies for the package pkg_foo.

The packages declared under CATKIN_DEPENDS are being find_package()-ed when other packages use pkg_foo and call find_package(pkg_foo) / find_package(catkin REQUIRED COMPONENTS pkg_foo). So these are run dependencies of package pkg_foo.

While it is common that a dependency is both - a build as well as a run dependency - there are cases where it might only be one of the two.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2019-05-09 20:28:48 -0500

Seen: 136 times

Last updated: May 15 '19