Skip to content

Commit

Permalink
Merge pull request #1994 from evan-palmer/bug-yaml-cpp-humble-build
Browse files Browse the repository at this point in the history
Resolve build error when linking yaml-cpp
  • Loading branch information
vooon authored Sep 22, 2024
2 parents 5884e2f + 925f214 commit afdb80f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mavros_extras/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ find_package(libmavconn REQUIRED)

find_package(eigen3_cmake_module REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(yaml_cpp_vendor REQUIRED)

## Find GeographicLib
Expand Down Expand Up @@ -132,7 +131,6 @@ add_library(mavros_extras_plugins SHARED
src/plugins/wheel_odometry.cpp
# [[[end]]] (checksum: 1f8cd51fa90b89b27ee35d276b5f8c83)
)
target_link_libraries(mavros_extras_plugins yaml-cpp::yaml-cpp)
ament_target_dependencies(mavros_extras_plugins
angles
geometry_msgs
Expand Down Expand Up @@ -165,7 +163,6 @@ add_library(mavros_extras SHARED
src/lib/servo_state_publisher.cpp
# [[[end]]] (checksum: a3ce43c71c567f697861bcbcd0f25aa3)
)
target_link_libraries(mavros_extras yaml-cpp::yaml-cpp)
ament_target_dependencies(mavros_extras
rclcpp
rclcpp_components
Expand All @@ -178,6 +175,13 @@ ament_target_dependencies(mavros_extras
)
rclcpp_components_register_node(mavros_extras PLUGIN "mavros::extras::ServoStatePublisher" EXECUTABLE servo_state_publisher)

# yaml-cpp is required for Jazzy and newer
if (rclcpp_VERSION VERSION_GREATER_EQUAL 22.0.0)
find_package(yaml-cpp REQUIRED)
target_link_libraries(mavros_extras_plugins yaml-cpp::yaml-cpp)
target_link_libraries(mavros_extras yaml-cpp::yaml-cpp)
endif()

install(TARGETS mavros_extras mavros_extras_plugins
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
Expand Down

0 comments on commit afdb80f

Please sign in to comment.