I have a package that depends on a message package called stdr_msgs. (stdr_msgs contains only messages). Here is the begining of the corresponding CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.3)
project(log_and_playback)
find_package(catkin REQUIRED COMPONENTS
roscpp rosbag_storage urdf kdl_parser tf2_ros tf2_kdl
stdr_msgs stdr_lib blf localize stdr_velodyne ladybug_playback
)
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS roscpp rosbag_storage urdf kdl_parser tf2_ros tf2_kdl
stdr_msgs stdr_lib blf localize stdr_velodyne ladybug_playback
)
include_directories(include ${catkin_INCLUDE_DIRS})
add_library(${PROJECT_NAME}
src/bag_reader.cpp
[...]
)
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES})
add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS})
Note that find_package searches for stdr_msgs and that the library depends on catkin_EXPORTED_TARGETS. This follows the guidelines in http://docs.ros.org/indigo/api/catkin/html/howto/format1/cpp_msg_dependencies.html
However, from time to time, the build fails because a header file from one of the messages in stdr_msgs is not found. It fails while compiling one of the cpp files from the library in this package.
Am I missing something?
EDIT: I printed the catkin_EXPORTED_TARGETS. It contained the stdr_msgs message generation targets. The list is long, it has 3842 elements from the following packages: actionlib, actionlib_msgs, bond, diagnostic_msgs, driver_base, dynamic_reconfigure, geometry_msgs, nav_msgs, nodelet, pcl_msgs, roscpp, rosgraph_msgs, sensor_msgs, std_msgs, stdr_msgs, tf2_msgs, tf, topic_tools, velodyne_msgs
↧