|
| 1 | +cmake_minimum_required(VERSION 3.14) |
| 2 | +project(rclcpp_async_example) |
| 3 | + |
| 4 | +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) |
| 5 | + |
| 6 | +if(NOT CMAKE_CXX_STANDARD) |
| 7 | + set(CMAKE_CXX_STANDARD 20) |
| 8 | +endif() |
| 9 | + |
| 10 | +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
| 11 | + add_compile_options(-Wall -Wextra -Wpedantic -Werror=deprecated-declarations -fcoroutines) |
| 12 | +endif() |
| 13 | + |
| 14 | +find_package(ament_cmake REQUIRED) |
| 15 | +find_package(rclcpp REQUIRED) |
| 16 | +find_package(rclcpp_action REQUIRED) |
| 17 | +find_package(rclcpp_async REQUIRED) |
| 18 | +find_package(std_msgs REQUIRED) |
| 19 | +find_package(std_srvs REQUIRED) |
| 20 | +find_package(example_interfaces REQUIRED) |
| 21 | + |
| 22 | +add_executable(demo_server src/demo_server.cpp) |
| 23 | +target_link_libraries(demo_server rclcpp_async::rclcpp_async |
| 24 | + ${std_msgs_TARGETS} ${std_srvs_TARGETS} ${example_interfaces_TARGETS}) |
| 25 | + |
| 26 | +add_executable(subscriber src/subscriber.cpp) |
| 27 | +target_link_libraries(subscriber rclcpp_async::rclcpp_async ${std_msgs_TARGETS}) |
| 28 | + |
| 29 | +add_executable(service_client src/service_client.cpp) |
| 30 | +target_link_libraries(service_client rclcpp_async::rclcpp_async ${std_srvs_TARGETS}) |
| 31 | + |
| 32 | +add_executable(action_client src/action_client.cpp) |
| 33 | +target_link_libraries(action_client rclcpp_async::rclcpp_async ${example_interfaces_TARGETS}) |
| 34 | + |
| 35 | +add_executable(nested_demo src/nested_demo.cpp) |
| 36 | +target_link_libraries(nested_demo rclcpp_async::rclcpp_async |
| 37 | + ${std_srvs_TARGETS} ${example_interfaces_TARGETS}) |
| 38 | + |
| 39 | +install(TARGETS demo_server subscriber service_client action_client nested_demo |
| 40 | + DESTINATION lib/${PROJECT_NAME} |
| 41 | +) |
| 42 | + |
| 43 | +install(DIRECTORY launch/ |
| 44 | + DESTINATION share/${PROJECT_NAME}/launch |
| 45 | +) |
| 46 | + |
| 47 | +if(BUILD_TESTING) |
| 48 | + find_package(ament_lint_auto REQUIRED) |
| 49 | + set(AMENT_LINT_AUTO_EXCLUDE ament_cmake_uncrustify ament_cmake_cppcheck) |
| 50 | + ament_lint_auto_find_test_dependencies() |
| 51 | +endif() |
| 52 | + |
| 53 | +ament_package() |
0 commit comments