I created a package A which only contains a header file to use in some other packages. But when trying to use the header in project B I always get the error "File not found". I found some questions here addressing the problem as "install issue". But I have the installation in my CMakeLists.txt of package A.

I also included ${CATKIN_INCLUDE_DIRS} in project B, but it still does not find the header file. CMakeLists.txt of A: cmake_minimum_required(VERSION 2.8.3) project(A) ## Find catkin macros and libraries ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) ## is used, also find other catkin packages find_package(catkin REQUIRED COMPONENTS geometry_msgs ndt_map roscpp rospy std_msgs ) ########### ## Build ## ########### ## Specify additional locations of header files ## Your package locations should be listed before other locations # include_directories(include) include_directories(${catkin_INCLUDE_DIRS}
include
)

#############
## Install ##
#############

## Mark cpp header files for installation
install(DIRECTORY include/${PROJECT_NAME}/ DESTINATION${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)


important part of CMakeLists.txt of project B:

find_package( catkin REQUIRED COMPONENTS
A
)
include_directories(
include
${catkin_INCLUDE_DIRS} )  edit retag close merge delete ## 1 Answer Sort by » oldest newest most voted In addition to installing header files, you also need to use the catkin_package command to inform other packages about where to find your header files when building from source in the same workspace: catkin_package(INCLUDE_DIRS include)  more ## Comments In addition to this: OP used find_package(A), but there is no corresponding include_directories([..]${A_INCLUDE_DIRS} [..]). Only find_package() is not enough. Alternatively, list A in find_package(catkin COMPONENTS [..] A [..]). Only then you rely on catkin_INCLUDE_DIRS.

( 2014-08-04 03:34:09 -0500 )edit

thank you both for your answers, @ahendrix approach was enough to solve the problem. @gvdhoom I actually used the "catkin COMPONENTS" tag, but I'm afraid I forgot to mention that in my question...

( 2014-08-04 04:07:54 -0500 )edit