Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

catkin_package vs. find_package

Tags:

ros

catkin

in the file CMakelists.txt I see find_packages and catkin_package:

find_package(catkin REQUIRED COMPONENTS roscpp rospy
image_transport std_msgs message_generation sensor_msgs
geometry_msgs )

catkin_package( CATKIN_DEPENDS message_runtime std_msgs sensor_msgs geometry_msgs )

What is the difference between those two things?

I tried to read about each thing in the tutorial, but it is not clear enough.

like image 777
user5547561 Avatar asked Dec 22 '15 15:12

user5547561


1 Answers

The answer is basically given by the auto-generated comments in the CMakeLists.txt:

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS ...

and

## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(...

The find_package command is common cmake and is needed to load the catkin macros and specify dependencies to other ROS packages.

The catkin_package command is one of these catkin macros. It is responsible for the ROS-specific configuration of the package. So this is the essential part that differentiates a ROS package from a common cmake project. I don't know details but I guess that it is, for example, responsible for setting the correct build paths of the catkin workspace.
The parameters given here (i.e. dependencies) are important when other ROS packages depend on this one.

like image 81
luator Avatar answered Oct 31 '22 12:10

luator