From e30b11c2a739bd95904d0641705bfbcb60960e9a Mon Sep 17 00:00:00 2001 From: matlabbe Date: Wed, 26 Jun 2024 20:12:25 -0700 Subject: [PATCH] Fixed cv_bridge.h build error on ros2 jazzy --- CMakeLists.txt | 4 ++++ src/ros2/CameraROS.h | 4 ++++ src/ros2/FindObjectROS.h | 4 ++++ src/ros2/print_objects_detected_node.cpp | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index aee5023..5611fd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -453,6 +453,10 @@ ELSE() # COLCON_BUILD DEPENDENCIES std_msgs sensor_msgs ) ament_export_dependencies(rosidl_default_runtime) + + IF("$ENV{ROS_DISTRO}" STRLESS "iron") + add_definitions(-DPRE_ROS_IRON) + ENDIF() ########### ## Build ## diff --git a/src/ros2/CameraROS.h b/src/ros2/CameraROS.h index c9e0f2c..39fae5a 100644 --- a/src/ros2/CameraROS.h +++ b/src/ros2/CameraROS.h @@ -29,7 +29,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define CAMERAROS_H_ #include +#ifdef PRE_ROS_IRON #include +#else +#include +#endif #include #include diff --git a/src/ros2/FindObjectROS.h b/src/ros2/FindObjectROS.h index 73c3fc8..844b28e 100644 --- a/src/ros2/FindObjectROS.h +++ b/src/ros2/FindObjectROS.h @@ -29,7 +29,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define FINDOBJECTROS_H_ #include +#ifdef PRE_ROS_IRON #include +#else +#include +#endif #include #include "find_object/FindObject.h" diff --git a/src/ros2/print_objects_detected_node.cpp b/src/ros2/print_objects_detected_node.cpp index 7d9cafb..ab805c5 100644 --- a/src/ros2/print_objects_detected_node.cpp +++ b/src/ros2/print_objects_detected_node.cpp @@ -31,7 +31,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#ifdef PRE_ROS_IRON #include +#else +#include +#endif #include #include #include