What is the cmake catkin variable for the workspace root dir?
Catkin puts the headers from my custom messages from package1 in
~/ros_ws/devel/include/<package1>/
I want to use them when compiling package2. I am assuming that the CMakeLists.txt for package2 needs a line like
include_directories(
${<WORSPACE_ROOT>}/devel/include
${catkin_INCLUDE_DIRS}
)
but I don't know the correct variable is for the workspace root, ie ~/ros_ws.
The other question is: is there a better way of doing than than manually specifying the top-level include dir?
Here are the CMakeLists.txt files:
ardrone_autonomy (project1) :
cmake_minimum_required(VERSION 2.8.3)
project(ardrone_autonomy)
find_package( catkin REQUIRED COMPONENTS roscpp rospy std_msgs image_transport sensor_msgs std_srvs tf camera_info_manager message_generation )
#uncomment if you have defined messages or services
add_message_files( FILES
matrix33.msg
navdata_adc_data_frame.msg
navdata_altitude.msg
navdata_demo.msg
navdata_euler_angles.msg
navdata_games.msg
navdata_gyros_offsets.msg
navdata_hdvideo_stream.msg
navdata_kalman_pressure.msg
navdata_magneto.msg
Navdata.msg
navdata_phys_measures.msg
navdata_pressure_raw.msg
navdata_pwm.msg
navdata_raw_measures.msg
navdata_rc_references.msg
navdata_references.msg
navdata_time.msg
navdata_trackers_send.msg
navdata_trims.msg
navdata_video_stream.msg
navdata_vision_detect.msg
navdata_vision.msg
navdata_vision_of.msg
navdata_vision_perf.msg
navdata_vision_raw.msg
navdata_watchdog.msg
navdata_wifi.msg
navdata_wind_speed.msg
navdata_zimmu_3000.msg
vector21.msg
vector31.msg
)
add_service_files(
FILES
CamSelect.srv
FlightAnim.srv
LedAnim.srv
)
generate_messages(
DEPENDENCIES
std_msgs
sensor_msgs
)
catkin_package(
INCLUDE_DIRS include devel/include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS roscpp std_msgs message_runtime
DEPENDS libsdl-dev
# DEPENDS system_lib
)
#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
find_package(Boost REQUIRED COMPONENTS)
set(SDK ARDroneLib/)
link_directories(${PROJECT_SOURCE_DIR}/lib/)
include_directories(${SDK} ${SDK}/FFMPEG/Includes ${SDK}/Soft/Common ${SDK}/Soft/Lib ${SDK}/VP_SDK ${SDK}/VP_SDK/VP_Os/linux )
add_executable(ardrone_driver src/ardrone_driver.cpp src/video.cpp src/ardrone_sdk.cpp src/teleop_twist.cpp)
target_link_libraries(ardrone_driver ${catkin_LIBRARIES} pc_ardrone avcodec avutil swscale vlib sdk SDL )
mrl_ardrone (project2) :
cmake_minimum_required(VERSION 2.8.3)
project(mrl_ardrone)
find_package(catkin REQUIRED COMPONENTS roscpp std_msgs cv_bridge ardrone_autonomy )
catkin_package(
INCLUDE_DIRS include
LIBRARIES mrl_ardrone
CATKIN_DEPENDS roscpp std_msgs cv_bridge ardrone_autonomy
# DEPENDS system_lib
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
# This is super sketchy, there must be an automated way to do this
/home/mike/ros_ws/devel/include/
${ROS_ROOT}
${catkin_INCLUDE_DIRS}
)
## Declare a cpp executable
add_executable( tracker src/tracker/trackerMain.cpp src/tracker/tracker.cpp src/tracker/drone_controller.cpp src/tracker/PID.cpp )
# make sure configure headers are built before any node using them
add_dependencies(tracker ardrone_autonomy)
add_executable( testMain src/tracker/testMain.cpp src/tracker/drone_controller.cpp src/tracker/PID.cpp )
add_dependencies( testMain ardrone_autonomy )
## Specify libraries to link a library or executable target against
find_package(OpenCV)
include_directories(${OpenCV_INCLUDE_DIRS})
find_package(cv_bridge)
include_directories(${cv_bridge_INCLUDE_DIRS})
target_link_libraries( tracker
${catkin_LIBRARIES}
${cv_bridge_INCLUDE_DIRS}
)
target_link_libraries( testMain
${catkin_LIBRARIES}
${cv_bridge_INCLUDE_DIRS}
)
When I run
~/ros_ws $ catkin_make
I get:
Project 'mrl_ardrone' tried to find library 'ardrone_autonomy'. The
library is neither a target nor built/installed properly. Did you compile
project 'ardrone_autonomy'? Did you find_package() it before the
subdirectory containing its code is included?
which suggests to me that my problem is not with the include directory itself, but something more general with CMake not being able to find stuff. But ...