ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The CMake files for ROS also set up package-config files, which can be queried for the build flags for a specific set of libraries. You can use the pkg-config
command-line utility for these queries.
On my desktop that has ROS installed, I can do:
Source the bashrc for my ROS workspace (in my case, I have indigo installed, but this can be the setup file for any ROS workspace). In particular, this sets the PKG_CONFIG_PATH to include the ROS directories, so pkg-config can find ROS packages.
$ source /opt/ros/indigo/setup.bash
Query pkg-config for the required include flags (ie compiler flags):
$ pkg-config roscpp --cflags
-I/opt/ros/indigo/include
Query pkg-config for the required link flags:
$ pkg-config roscpp --libs
-L/opt/ros/indigo/lib -lroscpp -lpthread -l:/usr/lib/x86_64-linux-gnu/libboost_signals.so -l:/usr/lib/x86_64-linux-gnu/libboost_filesystem.so -lrosconsole -lrosconsole_log4cxx -lrosconsole_backend_interface -l:/usr/lib/liblog4cxx.so -l:/usr/lib/x86_64-linux-gnu/libboost_regex.so -lxmlrpcpp -lroscpp_serialization -lrostime -l:/usr/lib/x86_64-linux-gnu/libboost_date_time.so -lcpp_common -l:/usr/lib/x86_64-linux-gnu/libboost_system.so -l:/usr/lib/x86_64-linux-gnu/libboost_thread.so -l:/usr/lib/x86_64-linux-gnu/libpthread.so -l:/usr/lib/x86_64-linux-gnu/libconsole_bridge.so
Your computer will give different results, depending on which version of ROS you have installed and how you've installed it.
You can run these commands once and copy the result into your makefile, or you can set up your makefile to run them and automatically include the output in your build flags.