Step 7 - Editing the CMakeLists.txt file

Another difference with respect to a common ROS node regards the compilation directives included in the CMakeLists.txt file. To build the calculator plugins and loader nodes, we should add the following lines in CMakeLists.txt:

## pluginlib_tutorials library 
add_library(pluginlib_calculator src/calculator_plugins.cpp) 
target_link_libraries(pluginlib_calculator ${catkin_LIBRARIES}) 
## calculator_loader executable 
add_executable(calculator_loader src/calculator_loader.cpp) 
target_link_libraries(calculator_loader ${catkin_LIBRARIES}) 

We are almost done with all the settings, and now it's time to build the package using the catkin_make command.

Get Mastering ROS for Robotics Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.