From e525cd3839a4648e0f016dc571f7ac474c7596c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Fr=C3=B6hlich?= Date: Sun, 4 Aug 2024 07:50:40 +0200 Subject: [PATCH] Add guards for correct version of ros2_control (#562) * Add guards for correct version of ros2_control * Check for cm instead of ros2_control --- example_1/CMakeLists.txt | 8 ++++++++ example_10/CMakeLists.txt | 8 ++++++++ example_11/CMakeLists.txt | 8 ++++++++ example_12/CMakeLists.txt | 8 ++++++++ example_14/CMakeLists.txt | 8 ++++++++ example_2/CMakeLists.txt | 8 ++++++++ example_3/CMakeLists.txt | 8 ++++++++ example_4/CMakeLists.txt | 8 ++++++++ example_5/CMakeLists.txt | 8 ++++++++ example_6/CMakeLists.txt | 8 ++++++++ example_7/CMakeLists.txt | 8 ++++++++ example_8/CMakeLists.txt | 8 ++++++++ example_9/CMakeLists.txt | 8 ++++++++ 13 files changed, 104 insertions(+) diff --git a/example_1/CMakeLists.txt b/example_1/CMakeLists.txt index 2ec1702ed..507f8f704 100644 --- a/example_1/CMakeLists.txt +++ b/example_1/CMakeLists.txt @@ -16,6 +16,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS rclcpp_lifecycle ) +# Specify the required version of ros2_control +find_package(controller_manager 4.0.0) +# Handle the case where the required version is not found +if(NOT controller_manager_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_10/CMakeLists.txt b/example_10/CMakeLists.txt index a9ee61abc..dee817871 100644 --- a/example_10/CMakeLists.txt +++ b/example_10/CMakeLists.txt @@ -19,6 +19,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS controller_interface ) +# Specify the required version of ros2_control +find_package(controller_manager 4.0.0) +# Handle the case where the required version is not found +if(NOT controller_manager_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_11/CMakeLists.txt b/example_11/CMakeLists.txt index e6abfba4b..fd424e2d0 100644 --- a/example_11/CMakeLists.txt +++ b/example_11/CMakeLists.txt @@ -16,6 +16,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS rclcpp_lifecycle ) +# Specify the required version of ros2_control +find_package(controller_manager 4.0.0) +# Handle the case where the required version is not found +if(NOT controller_manager_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_12/CMakeLists.txt b/example_12/CMakeLists.txt index ec887f4c3..793d5a29c 100644 --- a/example_12/CMakeLists.txt +++ b/example_12/CMakeLists.txt @@ -22,6 +22,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS std_msgs ) +# Specify the required version of ros2_control +find_package(controller_manager 4.0.0) +# Handle the case where the required version is not found +if(NOT controller_manager_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_14/CMakeLists.txt b/example_14/CMakeLists.txt index 6287ceba6..79d16afa4 100644 --- a/example_14/CMakeLists.txt +++ b/example_14/CMakeLists.txt @@ -17,6 +17,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS realtime_tools ) +# Specify the required version of ros2_control +find_package(controller_manager 4.0.0) +# Handle the case where the required version is not found +if(NOT controller_manager_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_2/CMakeLists.txt b/example_2/CMakeLists.txt index f419e6fde..ad35ade9d 100644 --- a/example_2/CMakeLists.txt +++ b/example_2/CMakeLists.txt @@ -16,6 +16,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS rclcpp_lifecycle ) +# Specify the required version of ros2_control +find_package(controller_manager 4.0.0) +# Handle the case where the required version is not found +if(NOT controller_manager_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_3/CMakeLists.txt b/example_3/CMakeLists.txt index 703c47f9d..bcae688de 100644 --- a/example_3/CMakeLists.txt +++ b/example_3/CMakeLists.txt @@ -16,6 +16,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS rclcpp_lifecycle ) +# Specify the required version of ros2_control +find_package(controller_manager 4.0.0) +# Handle the case where the required version is not found +if(NOT controller_manager_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_4/CMakeLists.txt b/example_4/CMakeLists.txt index 0666fc26d..0b3b6c40a 100644 --- a/example_4/CMakeLists.txt +++ b/example_4/CMakeLists.txt @@ -16,6 +16,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS rclcpp_lifecycle ) +# Specify the required version of ros2_control +find_package(controller_manager 4.0.0) +# Handle the case where the required version is not found +if(NOT controller_manager_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_5/CMakeLists.txt b/example_5/CMakeLists.txt index b5e2ed8cd..14424074f 100644 --- a/example_5/CMakeLists.txt +++ b/example_5/CMakeLists.txt @@ -16,6 +16,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS rclcpp_lifecycle ) +# Specify the required version of ros2_control +find_package(controller_manager 4.0.0) +# Handle the case where the required version is not found +if(NOT controller_manager_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_6/CMakeLists.txt b/example_6/CMakeLists.txt index da5ce30e4..127e33953 100644 --- a/example_6/CMakeLists.txt +++ b/example_6/CMakeLists.txt @@ -16,6 +16,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS rclcpp_lifecycle ) +# Specify the required version of ros2_control +find_package(controller_manager 4.0.0) +# Handle the case where the required version is not found +if(NOT controller_manager_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_7/CMakeLists.txt b/example_7/CMakeLists.txt index 7ce5fd05e..3813a4203 100644 --- a/example_7/CMakeLists.txt +++ b/example_7/CMakeLists.txt @@ -27,6 +27,14 @@ set(CONTROLLER_INCLUDE_DEPENDS trajectory_msgs ) +# Specify the required version of ros2_control +find_package(controller_manager 4.0.0) +# Handle the case where the required version is not found +if(NOT controller_manager_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_8/CMakeLists.txt b/example_8/CMakeLists.txt index 1edeb7888..5866833c5 100644 --- a/example_8/CMakeLists.txt +++ b/example_8/CMakeLists.txt @@ -17,6 +17,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS transmission_interface ) +# Specify the required version of ros2_control +find_package(controller_manager 4.0.0) +# Handle the case where the required version is not found +if(NOT controller_manager_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED) diff --git a/example_9/CMakeLists.txt b/example_9/CMakeLists.txt index 61f5b2478..957a10131 100644 --- a/example_9/CMakeLists.txt +++ b/example_9/CMakeLists.txt @@ -16,6 +16,14 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS rclcpp_lifecycle ) +# Specify the required version of ros2_control +find_package(controller_manager 4.0.0) +# Handle the case where the required version is not found +if(NOT controller_manager_FOUND) + message(FATAL_ERROR "ros2_control version 4.0.0 or higher is required. " + "Are you using the correct branch of the ros2_control_demos repository?") +endif() + # find dependencies find_package(backward_ros REQUIRED) find_package(ament_cmake REQUIRED)