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

When trying to create a header only catkin package you need to do two things.

  1. Mark the header as a required include for dependent packages using catkin_package
  2. Add an install tag for the header

This looks like the following in the CMakeLists.txt file

catkin_package(
  INCLUDE_DIRS include
)

install(DIRECTORY include/
  DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)

I believe the above is all you need, but if you run into issues you can also try adding the following between your catkin_package and install tags.

include_directories(
  include
)

Once your header package is good to go you just need to add it as a dependency for your executable

find_package(catkin REQUIRED COMPONENTS
  my_package
)

add_executable( my_executable_name src/my_source.cpp)

add_dependencies(my_executable_name ${catkin_EXPORTED_TARGETS})

Don't forget to also add it in the package.xml