# Exporting a built directory

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 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.
I tried that, but catkin complains about the directory not existing if I do a rebuild.