Exporting a built directory

asked 2018-07-01 21:49:40 -0600

KenYN gravatar image

updated 2018-07-01 21:50:35 -0600

I'm trying to make Caffe into a ROS package (one that just builds the DLL), and I have a problem where an intermediate header file gets built into build/.../caffe/include/caffe/proto/caffe.pb.h, but packages that link to caffe fail with errors about being unable to find caffe/proto/caffe.pb.h.

For caffe I use the supplied CMakeLists.txt with the addition of:

find_package(catkin REQUIRED)
catkin_package(INCLUDE_DIR include)

I see the header file being correctly built in the build tree.

For my project that includes caffe I have:

find_package(catkin REQUIRED COMPONENTS ... caffe)
catkin_package(CATKIN_DEPENDS ... caffe)
include_directories(caffe/include ${catkin_INCLUDE_DIRS})

If I print out ${catkin_INCLUDE_DIRS} I can see src/.../caffe/include/caffe/proto/caffe.pb.h, so how do I get build included also? I see that two of my .msg-only packages correctly reference build, but I cannot see what needs to be set to get caffe's build directory included.

edit retag flag offensive close merge delete


Not the best solution, but to make it work you can add ${CMAKE_CURRENT_BINARY_DIR}/include to the INCLUDE_DIR argument of catkin_package. Note that it's generally not a good practice to depend on files in the build space, they should ideally be in the devel/install space.

kartikmohta gravatar image kartikmohta  ( 2018-07-02 02:33:39 -0600 )edit

I tried that, but catkin complains about the directory not existing if I do a rebuild.

KenYN gravatar image KenYN  ( 2018-07-02 18:11:00 -0600 )edit