ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I was able to build it with the following changes.


In test-external-lib/external-lib/CMakeLists.txt create shared library instead of static

add_library(${PROJECT_NAME} SHARED src/my-lib.cc)

And in test-external-lib/executor/CMakeLists.txt, use

#ament_target_dependencies(${PROJECT_NAME} external-lib)
target_link_libraries(${PROJECT_NAME} PUBLIC external-lib::external-lib)

Finally, in test-external-lib/executor/src/exec.cc

auto tmp = new Consol();
tmp->Run(argc, argv);

I was able to build it with the following changes.


In test-external-lib/external-lib/CMakeLists.txt create shared library instead of static

add_library(${PROJECT_NAME} SHARED src/my-lib.cc)

And in test-external-lib/executor/CMakeLists.txt, use

#ament_target_dependencies(${PROJECT_NAME} external-lib)
target_link_libraries(${PROJECT_NAME} PUBLIC external-lib::external-lib)

Finally, in test-external-lib/executor/src/exec.cc

auto tmp = new Consol();
tmp->Run(argc, argv);

Edit after comment :

You can use STATIC library too.

In test-external-lib/external-lib/CMakeLists.txt, do the following 2 changes

1) ament couldnt find cli, so link it with target_link_libraries

#target_link_libraries(${PROJECT_NAME} PRIVATE cli::cli rclcpp::rclcpp)
target_link_libraries(${PROJECT_NAME} PRIVATE cli::cli)
ament_target_dependencies(${PROJECT_NAME} PUBLIC rclcpp)

2) export cli too

 #ament_export_dependencies(rclcpp)
 ament_export_dependencies(rclcpp cli)