How to add a node to CMakeLists.txt to build the package?
I have a node in a package and it is working fine, now i added one more node to src folder of same package, how can i add the node to CMakeLists.txt to compile and run the package. Is there any automatic way to build the package without modifying the CMakeLists.txt, just by inserting the node to src folder.
Edit: I have two nodes named image_converter.cpp and image_invert.cpp with same dependencies. My CMakeLists.txt is as follows. When i try to build it using cmake, i get the error as shown here. How to modify the CMakeLists.txt.
cmake_minimum_required(VERSION 2.8.3)
project(opencv_pkg)
find_package(catkin REQUIRED COMPONENTS
cv_bridge
image_transport
roscpp
sensor_msgs
std_msgs
)
include_directories(
${catkin_INCLUDE_DIRS}
)
add_library($image_convert src/image_converter.cpp)
target_link_libraries($image_convert
${avcodec_LIBRARIES}
${swscale_LIBRARIES}
${catkin_LIBRARIES}
)
add_executable($image_convert_node src/image_converter.cpp)
target_link_libraries($image_convert_node
$image_convert
${avcodec_LIBRARIES}
${swscale_LIBRARIES}
${catkin_LIBRARIES}
)
add_library($image_invert src/image_invert.cpp)
target_link_libraries($image_invert
${avcodec_LIBRARIES}
${swscale_LIBRARIES}
${catkin_LIBRARIES}
)
add_executable($image_invert_node src/image_invert.cpp)
target_link_libraries($image_invert_node
$image_invert
${avcodec_LIBRARIES}
${swscale_LIBRARIES}
${catkin_LIBRARIES}
)
@Kishore Kumar: please do not use answers to post updates to your question. Use the edit button for that (it's right under the main text of your question, with the little pen).