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

Revision history [back]

click to hide/show revision 1
initial version

install rules are valid for install space, but they're not the whole picture. cmake also requires Package-config.cmake files which tell it how to find your package, which libraries to include, etc.

When building with catkin_make, you're building in a development workspace, which is faster than running all of the install rules, but it also means that files aren't installed.

The catkin_package() call is designed to address both of these - it generates the requisite files so that other cmake files can find this project, and it allows other packages in your devel space to find your project.

To use catkin_package() correctly, you need to give it your install directory, any libraries that downstream packages should link to, any external dependencies that downstream projects need when building, and any catkin dependencies that downstream projects need when building.

For example (and I'm making things up because you're making things up), if your package has all of its includes in the include directory, and it builds a library called libmypacakge (with a cmake target name of mypackage), and it depends on roscpp (catkin package) and ffmpeg (external package), then your catkin_package call would look something like:

catkin_pacakge(
    INCLUDES include
    LIBRARIES mypacakge
    DEPENDS ffmpeg # same name you used to find the package earlier
    CATKIN_DEPENDS roscpp
)

If your package has headers that include the roscpp headers and the ffmpeg headers, this guarantees that their include directories will be on the include path for anyone who uses your library. (same for libraries).