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

How to put headers into devel/include folder with catkin_make?

asked 2014-04-08 06:17:14 -0500

Mike Charikov gravatar image

Have a lib in my package and want to share its header.

According to "how-to" I use this command:

install(DIRECTORY include/${PROJECT_NAME}/
    DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})

But after "catkin_make" command no headers are in devel/include folder. (Lib itself successfully appears in /devel/lib folder)

When I run "catkin_make install" command headers appear in install/include folder properly.

What am i doing wrong?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
6

answered 2014-04-08 07:00:43 -0500

Dirk Thomas gravatar image

That is fine as it is. The headers don't need to be copied from you package source folder to the devel/include folder. Just make sure that you export the include folder in your CMake file using:

catkin_package(INCLUDE_DIRS include)

And if you use your own headers add the folder to the include directories using:

include_directories(include)

Then any downstream package will find you package headers when adding the include directories with:

find_package(catkin REQUIRED COMPONENTS your_package)
include_directories(${catkin_INCLUDE_DIRS})
edit flag offensive delete link more

Comments

Thanks. That's was my folly: missed that find_package thing.

Mike Charikov gravatar image Mike Charikov  ( 2014-04-08 20:43:55 -0500 )edit
2

This works fine for building, but some IDEs won't be able to find the include directory, as this method doesn't add it to the CPATH variable. The devel/include directory *does* get added to the CPATH variable, though, so generated messages can be found by the IDE, but not the package's own headers.

Tom Moore gravatar image Tom Moore  ( 2014-04-29 11:22:33 -0500 )edit
1

Is there a way of getting your headers into the devel/include folder? Other than installing them there. In my case, it's for an external project that needs to find things in a standard place.

Nap gravatar image Nap  ( 2014-11-07 08:23:24 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-04-08 06:17:14 -0500

Seen: 5,858 times

Last updated: Apr 08 '14