Skip to content

Commit 235e2f3

Browse files
committed
Replaced ament_target_dependencies with target_link_lirabries
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
1 parent 4528f43 commit 235e2f3

11 files changed

Lines changed: 189 additions & 43 deletions

File tree

composition_benchmark/CMakeLists.txt

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,69 @@ find_package(rclcpp_components REQUIRED)
2121
add_library(composable_node SHARED
2222
src/composable_node.cpp
2323
)
24-
ament_target_dependencies(composable_node rclcpp rclcpp_components performance_test)
25-
target_include_directories(composable_node PUBLIC include)
24+
target_link_libraries(composable_node PUBLIC
25+
rclcpp::rclcpp
26+
rclcpp_components::component
27+
${performance_test_LIBRARIES}
28+
)
29+
target_include_directories(composable_node PUBLIC
30+
include
31+
${performance_test_INCLUDE_DIRS}
32+
)
2633
rclcpp_components_register_nodes(composable_node "ComposableNode")
2734

2835
add_library(composable_publisher SHARED
2936
src/composable_publisher.cpp
3037
)
31-
ament_target_dependencies(composable_publisher rclcpp rclcpp_components performance_test irobot_interfaces_plugin)
32-
target_include_directories(composable_publisher PUBLIC include)
38+
target_link_libraries(composable_publisher PUBLIC
39+
${irobot_interfaces_plugin_TARGETS}
40+
rclcpp::rclcpp
41+
rclcpp_components::component
42+
rclcpp_components::component_manager
43+
${performance_test_LIBRARIES}
44+
)
45+
target_include_directories(composable_publisher
46+
PUBLIC
47+
include
48+
${performance_test_INCLUDE_DIRS}
49+
)
3350
rclcpp_components_register_nodes(composable_publisher "ComposablePublisher")
3451

3552
add_library(composable_subscriber SHARED
3653
src/composable_subscriber.cpp
3754
)
38-
ament_target_dependencies(composable_subscriber rclcpp rclcpp_components performance_metrics performance_test irobot_interfaces_plugin)
39-
target_include_directories(composable_subscriber PUBLIC include)
55+
target_link_libraries(composable_subscriber PUBLIC
56+
${irobot_interfaces_plugin_TARGETS}
57+
rclcpp::rclcpp
58+
rclcpp_components::component
59+
rclcpp_components::component_manager
60+
${performance_test_LIBRARIES}
61+
${performance_metrics_LIBRARIES}
62+
)
63+
target_include_directories(composable_subscriber
64+
PUBLIC
65+
include
66+
${performance_test_INCLUDE_DIRS}
67+
${performance_metrics_INCLUDE_DIRS}
68+
)
4069
rclcpp_components_register_nodes(composable_subscriber "ComposableSubscriber")
4170

4271
add_library(base_node SHARED
4372
src/base_node.cpp
4473
)
45-
ament_target_dependencies(base_node rclcpp rclcpp_components performance_metrics performance_test)
46-
target_include_directories(base_node PUBLIC include)
74+
target_link_libraries(base_node PUBLIC
75+
rclcpp::rclcpp
76+
rclcpp_components::component
77+
rclcpp_components::component_manager
78+
${performance_test_LIBRARIES}
79+
${performance_metrics_LIBRARIES}
80+
)
81+
target_include_directories(base_node
82+
PUBLIC
83+
include
84+
${performance_test_INCLUDE_DIRS}
85+
${performance_metrics_INCLUDE_DIRS}
86+
)
4787

4888
add_subdirectory(apps)
4989

composition_benchmark/apps/CMakeLists.txt

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,45 @@
11
find_package(irobot_interfaces_plugin REQUIRED)
22

33
add_executable(base_simple_main base_simple_main.cpp)
4-
ament_target_dependencies(base_simple_main performance_test)
5-
target_link_libraries(base_simple_main base_node)
4+
target_link_libraries(base_simple_main
5+
base_node
6+
${performance_test_LIBRARIES}
7+
)
68

79
add_executable(base_publisher_main base_publisher_main.cpp)
8-
ament_target_dependencies(base_publisher_main performance_test performance_test_factory irobot_interfaces_plugin)
9-
target_link_libraries(base_publisher_main base_node)
10+
target_link_libraries(base_publisher_main
11+
${irobot_interfaces_plugin_TARGETS}
12+
${performance_test_LIBRARIES}
13+
${performance_test_factory_LIBRARIES}
14+
base_node
15+
)
1016

1117
add_executable(base_subscriber_main base_subscriber_main.cpp)
12-
ament_target_dependencies(base_subscriber_main performance_test performance_test_factory irobot_interfaces_plugin)
13-
target_link_libraries(base_subscriber_main base_node)
18+
target_link_libraries(base_subscriber_main
19+
${irobot_interfaces_plugin_TARGETS}
20+
${performance_test_LIBRARIES}
21+
${performance_test_factory_LIBRARIES}
22+
base_node
23+
)
1424

1525
add_executable(composable_simple_main composable_simple_main.cpp)
16-
ament_target_dependencies(composable_simple_main performance_test)
1726
target_link_libraries(composable_simple_main composable_node)
1827

1928
add_executable(composable_pub_sub_main composable_pub_sub_main.cpp)
20-
ament_target_dependencies(composable_pub_sub_main performance_test irobot_interfaces_plugin)
21-
target_link_libraries(composable_pub_sub_main composable_publisher composable_subscriber)
29+
target_link_libraries(composable_pub_sub_main
30+
${irobot_interfaces_plugin_TARGETS}
31+
${performance_test_LIBRARIES}
32+
composable_publisher
33+
composable_subscriber
34+
)
2235

2336
add_executable(multi_producer multi-producer-node.cpp)
24-
ament_target_dependencies(multi_producer performance_test irobot_interfaces_plugin)
25-
target_link_libraries(multi_producer composable_publisher composable_subscriber)
37+
target_link_libraries(multi_producer
38+
${irobot_interfaces_plugin_TARGETS}
39+
${performance_test_LIBRARIES}
40+
composable_publisher
41+
composable_subscriber
42+
)
2643

2744
install(TARGETS
2845
base_simple_main

irobot_benchmark/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,16 @@ find_package(performance_test REQUIRED)
1717
find_package(performance_test_factory REQUIRED)
1818

1919
add_executable(irobot_benchmark src/irobot_benchmark.cpp)
20-
ament_target_dependencies(irobot_benchmark rclcpp rclcpp_lifecycle performance_test performance_test_factory)
20+
target_include_directories(irobot_benchmark
21+
PUBLIC
22+
${performance_test_INCLUDE_DIRS}
23+
)
24+
target_link_libraries(irobot_benchmark
25+
rclcpp::rclcpp
26+
rclcpp_lifecycle::rclcpp_lifecycle
27+
${performance_test_LIBRARIES}
28+
${performance_test_factory_LIBRARIES}
29+
)
2130

2231
install(TARGETS
2332
irobot_benchmark
@@ -46,4 +55,3 @@ if(BUILD_TESTING)
4655
endif()
4756

4857
ament_package()
49-

performance_metrics/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ add_library(${LIBRARY_NAME} SHARED ${LIBRARY_SRC})
3333
target_include_directories(${LIBRARY_NAME} PUBLIC
3434
include
3535
)
36-
ament_target_dependencies(${LIBRARY_NAME} ${LIBRARY_DEPENDENCIES})
36+
target_link_libraries(${LIBRARY_NAME}
37+
${performance_test_msgs_TARGETS}
38+
rclcpp::rclcpp
39+
)
3740

3841
install(TARGETS
3942
${LIBRARY_NAME}

performance_metrics/test/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ ament_add_gtest(test_stat test_stat.cpp)
99
target_link_libraries(test_stat ${LIBRARY_NAME})
1010

1111
ament_add_gtest(test_tracker test_tracker.cpp)
12-
ament_target_dependencies(test_tracker performance_test_msgs)
13-
target_link_libraries(test_tracker ${LIBRARY_NAME})
12+
target_link_libraries(test_tracker
13+
${LIBRARY_NAME}
14+
${performance_test_msgs_TARGETS}
15+
)
1416

1517
ament_add_gtest(test_dummy_work test_dummy_work.cpp)
16-
ament_target_dependencies(test_dummy_work)
1718
target_link_libraries(test_dummy_work ${LIBRARY_NAME})

performance_test/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,14 @@ add_library(${LIBRARY_NAME} SHARED ${LIBRARY_SRC})
3636

3737
target_include_directories(${LIBRARY_NAME} PUBLIC
3838
include
39+
${performance_metrics_INCLUDE_DIRS}
40+
)
41+
target_link_libraries(${LIBRARY_NAME}
42+
rclcpp::rclcpp
43+
rclcpp_action::rclcpp_action
44+
${performance_metrics_LIBRARIES}
45+
${performance_test_msgs_TARGETS}
3946
)
40-
ament_target_dependencies(${LIBRARY_NAME} ${LIBRARY_DEPENDENCIES})
4147

4248
install(TARGETS
4349
${LIBRARY_NAME}

performance_test/test/CMakeLists.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,19 @@ ament_lint_auto_find_test_dependencies()
77

88
find_package(rclcpp_lifecycle REQUIRED)
99
ament_add_gtest(test_node test_node.cpp)
10-
ament_target_dependencies(test_node performance_metrics performance_test_msgs rclcpp_lifecycle)
11-
target_link_libraries(test_node ${LIBRARY_NAME})
10+
target_link_libraries(test_node
11+
${LIBRARY_NAME}
12+
${performance_test_msgs_TARGETS}
13+
${performance_metrics_LIBRARIES}
14+
rclcpp_lifecycle::rclcpp_lifecycle
15+
)
1216

1317
ament_add_gtest(test_system test_system.cpp)
14-
ament_target_dependencies(test_system performance_metrics performance_test_msgs)
15-
target_link_libraries(test_system ${LIBRARY_NAME})
18+
target_link_libraries(test_system
19+
${LIBRARY_NAME}
20+
${performance_test_msgs_TARGETS}
21+
${performance_metrics_LIBRARIES}
22+
)
1623

1724
ament_add_gtest(test_executors test_executors.cpp)
1825
target_link_libraries(test_executors ${LIBRARY_NAME})

performance_test_examples/CMakeLists.txt

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,74 @@ find_package(performance_test_factory REQUIRED)
2020
##
2121

2222
add_executable(publisher_nodes_main src/publisher_nodes_main.cpp)
23-
ament_target_dependencies(publisher_nodes_main rclcpp performance_test performance_test_factory)
23+
target_include_directories(publisher_nodes_main PUBLIC
24+
${performance_test_INCLUDE_DIRS}
25+
)
26+
target_link_libraries(publisher_nodes_main
27+
rclcpp::rclcpp
28+
${performance_test_LIBRARIES}
29+
${performance_test_factory_LIBRARIES}
30+
)
2431

2532
add_executable(subscriber_nodes_main src/subscriber_nodes_main.cpp)
26-
ament_target_dependencies(subscriber_nodes_main rclcpp performance_test performance_test_factory)
33+
target_include_directories(subscriber_nodes_main PUBLIC
34+
${performance_test_INCLUDE_DIRS}
35+
)
36+
target_link_libraries(subscriber_nodes_main
37+
rclcpp::rclcpp
38+
${performance_test_LIBRARIES}
39+
${performance_test_factory_LIBRARIES}
40+
)
2741

2842
add_executable(client_nodes_main src/client_nodes_main.cpp)
29-
ament_target_dependencies(client_nodes_main rclcpp performance_test performance_test_factory)
43+
target_include_directories(client_nodes_main PUBLIC
44+
${performance_test_INCLUDE_DIRS}
45+
)
46+
target_link_libraries(client_nodes_main
47+
rclcpp::rclcpp
48+
${performance_test_LIBRARIES}
49+
${performance_test_factory_LIBRARIES}
50+
)
3051

3152
add_executable(server_nodes_main src/server_nodes_main.cpp)
32-
ament_target_dependencies(server_nodes_main rclcpp performance_test performance_test_factory)
53+
target_include_directories(server_nodes_main PUBLIC
54+
${performance_test_INCLUDE_DIRS}
55+
)
56+
target_link_libraries(server_nodes_main
57+
rclcpp::rclcpp
58+
${performance_test_LIBRARIES}
59+
${performance_test_factory_LIBRARIES}
60+
)
3361

3462
add_executable(simple_pub_sub_main src/simple_pub_sub_main.cpp)
35-
ament_target_dependencies(simple_pub_sub_main rclcpp performance_test performance_test_factory)
63+
target_include_directories(simple_pub_sub_main PUBLIC
64+
${performance_test_INCLUDE_DIRS}
65+
)
66+
target_link_libraries(simple_pub_sub_main
67+
rclcpp::rclcpp
68+
${performance_test_LIBRARIES}
69+
${performance_test_factory_LIBRARIES}
70+
)
3671

3772
add_executable(simple_client_service_main src/simple_client_service_main.cpp)
38-
ament_target_dependencies(simple_client_service_main rclcpp performance_test performance_test_factory)
73+
target_include_directories(simple_client_service_main PUBLIC
74+
${performance_test_INCLUDE_DIRS}
75+
)
76+
target_link_libraries(simple_client_service_main
77+
rclcpp::rclcpp
78+
${performance_test_LIBRARIES}
79+
${performance_test_factory_LIBRARIES}
80+
)
3981

4082
add_executable(json_system_main src/json_system_main.cpp)
41-
ament_target_dependencies(json_system_main rclcpp performance_test performance_test_factory)
83+
target_include_directories(json_system_main PUBLIC
84+
${performance_test_INCLUDE_DIRS}
85+
)
86+
target_link_libraries(json_system_main
87+
rclcpp::rclcpp
88+
${performance_test_LIBRARIES}
89+
${performance_test_factory_LIBRARIES}
90+
)
4291

4392
install(TARGETS
4493
publisher_nodes_main

performance_test_factory/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,16 @@ target_include_directories(
4242
PUBLIC
4343
external/cxxopts/include
4444
include
45+
${performance_test_INCLUDE_DIRS}
4546
)
4647

47-
ament_target_dependencies(${LIBRARY_NAME} ${LIBRARY_DEPENDENCIES})
48-
target_link_libraries(${LIBRARY_NAME} nlohmann_json::nlohmann_json)
48+
target_link_libraries(${LIBRARY_NAME}
49+
rcpputils::rcpputils
50+
rclcpp::rclcpp
51+
rclcpp_lifecycle::rclcpp_lifecycle
52+
${performance_test_LIBRARIES}
53+
nlohmann_json::nlohmann_json
54+
)
4955

5056
install(TARGETS
5157
${LIBRARY_NAME}

performance_test_factory/test/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ find_package(ament_cmake_pytest REQUIRED)
66
ament_lint_auto_find_test_dependencies()
77

88
ament_add_gtest(test_factory test_factory.cpp)
9-
ament_target_dependencies(test_factory performance_test_msgs)
10-
target_link_libraries(test_factory ${LIBRARY_NAME})
9+
target_link_libraries(test_factory
10+
${LIBRARY_NAME}
11+
${performance_test_msgs_TARGETS}
12+
)

0 commit comments

Comments
 (0)