The cmake macro target_link_libraries is used to specify which libraries are needed to link against when you build each target (library or executable). In your case, you have two targets, talker and listener, so you will need to call target_link_libraries twice, e.g. target_link_libraries(talker \${catkin_LIBRARIES})