Skip to content

Commit e022a94

Browse files
committed
Fix ament_target_dependencies removal
Signed-off-by: David Laseca Perez <davidlaseca@eprosima.com>
1 parent c1c3f49 commit e022a94

30 files changed

Lines changed: 128 additions & 75 deletions

File tree

rclc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.10)
22

33
project(micro_ros_demos_rclc)
44

rclc/addtwoints_client/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.10)
22

33
project(addtwoints_client LANGUAGES C)
44

@@ -9,7 +9,9 @@ find_package(example_interfaces REQUIRED)
99

1010
add_executable(${PROJECT_NAME} main.c)
1111

12-
ament_target_dependencies(${PROJECT_NAME}
12+
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/ament_target_dependencies_compat.cmake)
13+
14+
ament_target_dependencies_compat(${PROJECT_NAME}
1315
rcl
1416
rclc
1517
example_interfaces

rclc/addtwoints_server/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.10)
22

33
project(addtwoints_server LANGUAGES C)
44

@@ -9,7 +9,9 @@ find_package(example_interfaces REQUIRED)
99

1010
add_executable(${PROJECT_NAME} main.c)
1111

12-
ament_target_dependencies(${PROJECT_NAME}
12+
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/ament_target_dependencies_compat.cmake)
13+
14+
ament_target_dependencies_compat(${PROJECT_NAME}
1315
rcl
1416
rclc
1517
example_interfaces

rclc/autodiscover_agent/CMakeLists.txt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.10)
22

33
project(autodiscover_agent LANGUAGES C)
44

@@ -8,21 +8,17 @@ find_package(rclc REQUIRED)
88
find_package(std_msgs REQUIRED)
99
find_package(microxrcedds_client REQUIRED)
1010
find_package(rmw_microxrcedds REQUIRED)
11-
find_package(microxrcedds_client REQUIRED)
1211

1312
add_executable(${PROJECT_NAME} main.c)
1413

15-
target_link_libraries(${PROJECT_NAME}
16-
microxrcedds_client
17-
)
14+
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/ament_target_dependencies_compat.cmake)
1815

19-
ament_target_dependencies(${PROJECT_NAME}
16+
ament_target_dependencies_compat(${PROJECT_NAME}
2017
rcl
2118
rclc
2219
std_msgs
2320
microxrcedds_client
2421
rmw_microxrcedds
25-
microxrcedds_client
2622
)
2723

2824
install(TARGETS ${PROJECT_NAME}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# ament_cmake no longer provides ament_target_dependencies(). This links each
2+
# named dependency's modern imported target if it exists, falling back to the
3+
# classic <dep>_INCLUDE_DIRS / <dep>_LIBRARIES variables otherwise.
4+
macro(ament_target_dependencies_compat _target)
5+
foreach(_dep ${ARGN})
6+
if(TARGET ${_dep}::${_dep})
7+
target_link_libraries(${_target} ${_dep}::${_dep})
8+
elseif(TARGET ${_dep})
9+
target_link_libraries(${_target} ${_dep})
10+
else()
11+
if(${_dep}_INCLUDE_DIRS)
12+
target_include_directories(${_target} PUBLIC ${${_dep}_INCLUDE_DIRS})
13+
endif()
14+
if(${_dep}_LIBRARIES)
15+
target_link_libraries(${_target} ${${_dep}_LIBRARIES})
16+
endif()
17+
endif()
18+
endforeach()
19+
endmacro()

rclc/complex_msg_publisher/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.10)
22

33
project(complex_msg_publisher LANGUAGES C)
44

@@ -10,7 +10,9 @@ find_package(rmw_microxrcedds REQUIRED)
1010

1111
add_executable(${PROJECT_NAME} main.c)
1212

13-
ament_target_dependencies(${PROJECT_NAME}
13+
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/ament_target_dependencies_compat.cmake)
14+
15+
ament_target_dependencies_compat(${PROJECT_NAME}
1416
rcl
1517
rclc
1618
complex_msgs

rclc/complex_msg_subscriber/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.10)
22

33
project(complex_msg_subscriber LANGUAGES C)
44

@@ -10,7 +10,9 @@ find_package(rmw_microxrcedds REQUIRED)
1010

1111
add_executable(${PROJECT_NAME} main.c)
1212

13-
ament_target_dependencies(${PROJECT_NAME}
13+
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/ament_target_dependencies_compat.cmake)
14+
15+
ament_target_dependencies_compat(${PROJECT_NAME}
1416
rcl
1517
rclc
1618
complex_msgs
@@ -20,4 +22,3 @@ ament_target_dependencies(${PROJECT_NAME}
2022
install(TARGETS ${PROJECT_NAME}
2123
DESTINATION ${PROJECT_NAME}
2224
)
23-

rclc/configuration_example/configured_publisher/CMakeLists.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.10)
22

33
project(configured_publisher LANGUAGES C)
44

@@ -11,11 +11,9 @@ find_package(rmw_microxrcedds REQUIRED)
1111

1212
add_executable(${PROJECT_NAME} main.c)
1313

14-
target_link_libraries(${PROJECT_NAME}
15-
microxrcedds_client
16-
)
14+
include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/ament_target_dependencies_compat.cmake)
1715

18-
ament_target_dependencies(${PROJECT_NAME}
16+
ament_target_dependencies_compat(${PROJECT_NAME}
1917
rcl
2018
rclc
2119
std_msgs
@@ -26,4 +24,3 @@ ament_target_dependencies(${PROJECT_NAME}
2624
install(TARGETS ${PROJECT_NAME}
2725
DESTINATION ${PROJECT_NAME}
2826
)
29-

rclc/configuration_example/configured_subscriber/CMakeLists.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.10)
22

33
project(configured_subscriber LANGUAGES C)
44

@@ -11,11 +11,9 @@ find_package(microxrcedds_client REQUIRED)
1111

1212
add_executable(${PROJECT_NAME} main.c)
1313

14-
target_link_libraries(${PROJECT_NAME}
15-
microxrcedds_client
16-
)
14+
include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/ament_target_dependencies_compat.cmake)
1715

18-
ament_target_dependencies(${PROJECT_NAME}
16+
ament_target_dependencies_compat(${PROJECT_NAME}
1917
rcl
2018
rclc
2119
std_msgs
@@ -26,4 +24,3 @@ ament_target_dependencies(${PROJECT_NAME}
2624
install(TARGETS ${PROJECT_NAME}
2725
DESTINATION ${PROJECT_NAME}
2826
)
29-

rclc/configuration_example/custom_transports/CMakeLists.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.10)
22

33
project(custom_transports LANGUAGES C)
44

@@ -11,11 +11,9 @@ find_package(microxrcedds_client REQUIRED)
1111

1212
add_executable(${PROJECT_NAME} main.c)
1313

14-
target_link_libraries(${PROJECT_NAME}
15-
microxrcedds_client
16-
)
14+
include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/ament_target_dependencies_compat.cmake)
1715

18-
ament_target_dependencies(${PROJECT_NAME}
16+
ament_target_dependencies_compat(${PROJECT_NAME}
1917
rcl
2018
rclc
2119
std_msgs
@@ -33,4 +31,3 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
3331
install(TARGETS ${PROJECT_NAME}
3432
DESTINATION ${PROJECT_NAME}
3533
)
36-

0 commit comments

Comments
 (0)