Revision history [back]

Is there a simple way to find ROS headers in CMake without catkin?

I am building an external library that will be linked in as part of a ros package, but is built outside of Catkin.

I'd like to use some of the ROS messages (e.g. ROS_INFO, ROS_DEBUG) inside this library for debugging.

I have manually modified the CMake to include_directories( /opt/ros/kinetic/include/) and the code works as I want.

I'd like to do something like:

find_package( roscpp )
if (ROSCPP_FOUND)
include_directories(\${ROSCPP_INCLUDE_DIRS})
...


Unfortunately, CMake can't find roscpp without all of the catkin magic.
I don't want to find_package(catkin) as it messes with the normal CMake build setup for the library.

One hack I can think of is to check the ROS_ROOT environment variable, and if it exists, make the include relative to that. But that is a hack that I'd prefer to avoid.

Is there a clean minimal setup that can discover the ROS include directory with pure CMake?