Skip to content

Commit

Permalink
Switch to target_link_libraries. (#776)
Browse files Browse the repository at this point in the history
There really isn't any need to use ament_target_dependencies.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
  • Loading branch information
clalancette authored Nov 27, 2023
1 parent dc7fedf commit 5d8191e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
9 changes: 4 additions & 5 deletions rosidl_runtime_c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ add_library(${PROJECT_NAME}
target_include_directories(${PROJECT_NAME} PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")
ament_target_dependencies(${PROJECT_NAME}
"rcutils"
"rosidl_typesupport_interface")
target_link_libraries(${PROJECT_NAME} PUBLIC
rcutils::rcutils
rosidl_typesupport_interface::rosidl_typesupport_interface
)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
set_target_properties(${PROJECT_NAME} PROPERTIES
COMPILE_OPTIONS -Wall -Wextra -Wpedantic)
Expand Down Expand Up @@ -116,8 +117,6 @@ if(BUILD_TESTING)

ament_add_gtest(test_sequence_bound test/test_sequence_bound.cpp)
if(TARGET test_sequence_bound)
ament_target_dependencies(test_sequence_bound
"rosidl_typesupport_interface")
target_link_libraries(test_sequence_bound ${PROJECT_NAME})
endif()

Expand Down
13 changes: 5 additions & 8 deletions rosidl_typesupport_introspection_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ find_package(ament_cmake_ros REQUIRED)
find_package(rosidl_runtime_cpp REQUIRED)
find_package(rosidl_typesupport_introspection_c REQUIRED)

ament_export_dependencies(rosidl_runtime_c)
ament_export_dependencies(rosidl_runtime_cpp)
ament_export_dependencies(rosidl_typesupport_interface)
ament_export_dependencies(rosidl_typesupport_introspection_c)

ament_export_dependencies(rosidl_runtime_cpp rosidl_typesupport_introspection_c)

ament_python_install_package(${PROJECT_NAME})

Expand All @@ -32,9 +28,10 @@ endif()
target_include_directories(${PROJECT_NAME} PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")
ament_target_dependencies(${PROJECT_NAME}
rosidl_runtime_cpp
rosidl_typesupport_introspection_c)
target_link_libraries(${PROJECT_NAME} PUBLIC
rosidl_runtime_cpp::rosidl_runtime_cpp
rosidl_typesupport_introspection_c::rosidl_typesupport_introspection_c
)

# Export old-style CMake variables
ament_export_include_directories("include/${PROJECT_NAME}")
Expand Down

0 comments on commit 5d8191e

Please sign in to comment.