What's the proper way to include external libraries in a C++ ROS package?
I've written a C++ program that reads data from an I2C device using the [I2Cdevlib](https://github.com/jrowberg/i2cdevlib), and now I'm trying to re-package it as a ROS node and build it via catkin.
I'm building the non-catkin code via:
gcc -o mpu6050_reader ${PATH_I2CDEVLIB}RaspberryPi_bcm2835/MPU6050/examples/MPU6050_example_1.cpp \
-I ${PATH_I2CDEVLIB}RaspberryPi_bcm2835/I2Cdev ${PATH_I2CDEVLIB}RaspberryPi_bcm2835/I2Cdev/I2Cdev.cpp \
-I ${PATH_I2CDEVLIB}Arduino/MPU6050/ ${PATH_I2CDEVLIB}Arduino/MPU6050/MPU6050.cpp -l bcm2835 -l m
I've initialized a C++ ROS package, and refactored MPU6050_example_1.cpp into the ROS-equivalent mpu6050_node.cpp, and now I'm trying to translate the above call to CMakeLists.txt so it compiles with `catkin_make`. What's the best way to do this?
Should I include the i2cdevlib and bcm2835 libraries in my package, or require the user to download and install them separately?
I've read through the documentation on [CMakeLists.txt](http://wiki.ros.org/catkin/CMakeLists.txt), but it's unclear to me which parameters I should use. Should I use `add_library()` or `include_directories()` or `add_dependencies()` or `target_link_libraries()`?
↧