Adding external dependency (FLANN) to catkin package
I'm trying to add FLANN (Fast Library for Approximate Nearest Neighbors) as a system dependency to a catkin package. I installed FLANN from the source as instructed on the website and then setup my ROS package's CMakeList.txt as follows:
cmake_minimum_required(VERSION 2.8.3)
project(nao_whole_body_ik)
find_package(catkin REQUIRED COMPONENTS
roscpp)
find_package( PkgConfig REQUIRED)
pkg_check_modules( flann REQUIRED flann )
catkin_package(
INCLUDE_DIRS include
LIBRARIES nao_whole_body_ik
)
include_directories(include ${catkin_INCLUDE_DIRS})
add_executable(test_node src/test1_node.cpp)
target_link_libraries(test_node ${catkin_LIBRARIES})
Then in my test1_node.cpp
file I just have the test code given on their website, which consists of the following 2 include directives:
#include <flann/flann.hpp>
#include <flann/io/hdf5.h>
The first include statement works fine. The second one produces a long list of linking errors complaining about undefined references to various functions. I'm not very good at configuring the CMakeLists file, but I suspect that I need to add hdf5
as a system dependency as well, but I can't figure out how to add multiple system dependencies. Simply writing pkg_check_modules( flann REQUIRED flann hdf5 )
doesn't work.
I'm using Ubuntu 14.04 with ROS Indigo.