Find_package() unable to find packages that I've created in the workspace.
I've been having a weird issue where I get the following error.
Project 'gimbal_control' tried to find library 'mav_recv'. The library is
neither a target nor built/installed properly. Did you compile project
'mav_recv'? Did you find_package() it before the subdirectory containing
its code is included?
When the existing ROS packages i.e. roscpp / nodelet that are in the find_library() function work fine. However when I include my package such as mav_recv or gstreamer_udp, it gives me the following error. The other 2 packages that are independent, build just fine by themselves. However, this package that is reliant on mav_recv messages gives me that cmake error. It seems that the find_library() function is unable to locate my packages in the current workspace, while it does find packages in the ROS workspace (I've installed ROS from source in ros_catkin_ws).
I've included both ROS workspaces in the /.bashrc file. And ROS is able to run the gstreamer_udp and mav_recv nodes when built individually. Here is my CMakeLists.txt for mav_recv,
cmake_minimum_required(VERSION 2.8.3)
project(mav_recv)
find_package(catkin REQUIRED COMPONENTS roscpp message_generation)
add_message_files(
FILES
Camera_mode.msg
Gimbal_commands.msg
)
generate_messages()
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS roscpp message_runtime
)
include_directories(include
# For mavlink messages
/home/pi/mavlink/include/uwa_grand_challenge
${catkin_INCLUDE_DIRS})
add_executable(mav_recv_node src/mav_recv_node.cpp)
add_dependencies(mav_recv_node ${${PROJECT_NAME}_EXPORTED_TARGETS})
add_library(mav_recv_lib src/mav_recv.cpp)
target_link_libraries(
mav_recv_node
mav_recv_lib
${catkin_LIBRARIES}
)
and gimbal_control CMakeLists.txt,
cmake_minimum_required(VERSION 2.8.3)
project(gimbal_control)
find_package(catkin REQUIRED COMPONENTS roscpp mav_recv)
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS roscpp mav_recv
)
include_directories(include ${catkin_INCLUDE_DIRS})
add_executable(gimbal_control_node src/gimbal_control_node.cpp)
add_dependencies(gimbal_control_node ${catkin_EXPORTED_TARGETS})
add_library(gimbal_control_lib src/gimbal_control.cpp src/i2c_bus.cpp)
add_dependencies(gimbal_control_lib ${catkin_EXPORTED_TARGETS})
target_link_libraries(
gimbal_control_node
gimbal_control_lib
${catkin_LIBRARIES}
)
Any help would really be appreciated as I've spent a long time on trying to get it to work.
Thanks,