Ask Your Question

Revision history [back]

This is more a generic CMake question than really ROS specific (ie: setting up your include path is not something that is any different whether you do it for a ROS node or for a non-ROS application / build target).

In the general case, in your CMakeLists.txt:

include_directories(/path/to/the/include/dir)

For a ROS package, you probably want the include sub directory of your package to be on the include path, so:

# note: this path is relative to the current CMakeLists.txt
include_directories(include)

If you have used find_package(catkin COMPONENTS ..), you probably want something like:

include_directories(include ${catkin_INCLUDE_DIRS})

The x_INCLUDE_DIRS (where x is a package name) is a general pattern: most CMake Find scripts will set these variables for you, but do check the documentation.

See How to do common tasks » Package format 2 (recommended) » C++ system library dependencies for some more info on resolving and using system dependencies with Catkin (but again, really: CMake).