Step 6 - Editing CMakeLists.txt

We need to add additional lines of code in CMakeLists.txt to build a nodelet package. Here are the extra lines. You will get the complete CMakeLists.txt file from the existing package itself:

## Declare a cpp library 
 add_library(nodelet_hello_world 
   src/hello_world.cpp 
 ) 
 
## Specify libraries to link a library or executable target against 
 target_link_libraries(nodelet_hello_world 
   ${catkin_LIBRARIES} 
 ) 

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.