Catkin unable to include custom libraries
I have a package proj_util
which is using the following catkin files, which seem to correctly generate the libraries and put them into ~/catkin_ws/devel/lib
.
CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.3)
project(proj_util)
find_package(catkin REQUIRED COMPONENTS
roscpp
sensor_msgs
)
catkin_package(
LIBRARIES visionutil rosutil
)
ADD_LIBRARY(visionutil src/math.cpp src/math.hpp)
ADD_LIBRARY(rosutil src/rosutil.cpp src/rosutil.hpp)
package.xml
<?xml version="1.0"?>
<package>
<name>proj_util</name>
<version>0.0.0</version>
<description>Package for utility libraries</description>
<maintainer email="ras@todo.todo">me</maintainer>
<license>TODO</license>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<run_depend>roscpp</run_depend>
<buildtool_depend>opencv2</buildtool_depend>
<run_depend>opencv2</run_depend>
<export>
</export>
</package>
However, when I try and use the libraries in another package, compilation crashes, stating that the header file cannot be found. The CMakeLists.txt for the package in which I want to use the libraries look like this:
cmake_minimum_required(VERSION 2.8.3)
project(motor_controller2)
find_package(catkin REQUIRED COMPONENTS roscpp std_msgs ras_arduino_msgs proj_util)
catkin_package(
CATKIN_DEPENDS roscpp std_msgs ras_arduino_msgs proj_util
)
include_directories(${catkin_INCLUDE_DIRS})
add_executable(motor_controller2 src/motorController2.cpp)
target_link_libraries(motor_controller2 ${catkin_LIBRARIES} rosutil)
add_dependencies(motor_controller2 ${catkin_EXPORTED_TARGETS})
I added references to the proj_util
package to anywhere where it seemed relevant, but it didn't seem to make any difference. I also tried using the names of the libraries instead, but to no avail.
I've tried using numerous variations on #include <rosutil/rosutil.hpp>
, but none of them seem to work. I tried using
catkin_package(
LIBRARIES visionutil rosutil
INCLUDE_DIRS include
)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
as recommended by this tutorial on building libraries, but even with this nothing seems to change.
I've tried to locate the files generated by the CMakeLists.txt for the library package, and other than the files used by make, the only files are librosutil.so
and libvisionutil.so
, located in ~/catkin_ws/devel/lib
. Specifically, there are no references in any include directory to these library files.
What am I doing wrong?