File tree Expand file tree Collapse file tree 6 files changed +41
-48
lines changed
ethercat_driver_ros2/sphinx/developer_guide
ethercat_generic_cia402_drive Expand file tree Collapse file tree 6 files changed +41
-48
lines changed Original file line number Diff line number Diff line change @@ -18,19 +18,17 @@ add_library(
18
18
SHARED
19
19
src/ethercat_driver.cpp )
20
20
21
- target_include_directories (
22
- ${PROJECT_NAME}
23
- PRIVATE
24
- include
21
+ target_include_directories (${PROJECT_NAME} PRIVATE
22
+ $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include>
23
+ $< INSTALL_INTERFACE:include/${PROJECT_NAME} >
25
24
)
26
25
27
- ament_target_dependencies (
28
- ${PROJECT_NAME}
29
- hardware_interface
30
- pluginlib
31
- rclcpp
32
- rclcpp_lifecycle
33
- ethercat_interface
26
+ target_link_libraries (${PROJECT_NAME} PUBLIC
27
+ hardware_interface::hardware_interface
28
+ pluginlib::pluginlib
29
+ rclcpp::rclcpp
30
+ rclcpp_lifecycle::rclcpp_lifecycle
31
+ ethercat_interface::ethercat_interface
34
32
)
35
33
36
34
# Causes the visibility macros to use dllexport rather than dllimport,
Original file line number Diff line number Diff line change @@ -137,10 +137,9 @@ Modify your :code:`CMakeLists.txt` file so that it looks like this:
137
137
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
138
138
$<INSTALL_INTERFACE:include>
139
139
)
140
- ament_target_dependencies(
141
- ${PROJECT_NAME}
142
- "ethercat_interface"
143
- "pluginlib"
140
+ target_link_libraries(${PROJECT_NAME} PUBLIC
141
+ ethercat_interface::ethercat_interface
142
+ pluginlib::pluginlib
144
143
)
145
144
pluginlib_export_plugin_description_file(ethercat_interface ethercat_plugins.xml)
146
145
install(
Original file line number Diff line number Diff line change @@ -26,15 +26,11 @@ target_compile_features(${PROJECT_NAME} PUBLIC c_std_99 cxx_std_17) # Require C
26
26
target_include_directories (${PROJECT_NAME} PUBLIC
27
27
$< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include>
28
28
$< INSTALL_INTERFACE:include> )
29
- target_link_libraries (${PROJECT_NAME} yaml-cpp )
30
29
31
-
32
- ament_target_dependencies (
33
- ${PROJECT_NAME}
34
- ethercat_interface
35
- ethercat_generic_slave
36
- pluginlib
37
- yaml_cpp_vendor
30
+ target_link_libraries (${PROJECT_NAME} PUBLIC
31
+ ethercat_interface::ethercat_interface
32
+ ethercat_generic_slave::ethercat_generic_slave
33
+ pluginlib::pluginlib
38
34
yaml-cpp
39
35
)
40
36
Original file line number Diff line number Diff line change @@ -25,14 +25,9 @@ target_compile_features(${PROJECT_NAME} PUBLIC c_std_99 cxx_std_17) # Require C
25
25
target_include_directories (${PROJECT_NAME} PUBLIC
26
26
$< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include>
27
27
$< INSTALL_INTERFACE:include> )
28
- ament_target_dependencies (
29
- ${PROJECT_NAME}
30
- ethercat_interface
31
- pluginlib
32
- yaml_cpp_vendor
33
- yaml-cpp
34
- )
35
- target_link_libraries (${PROJECT_NAME}
28
+ target_link_libraries (${PROJECT_NAME} PUBLIC
29
+ ethercat_interface::ethercat_interface
30
+ pluginlib::pluginlib
36
31
yaml-cpp
37
32
)
38
33
@@ -70,7 +65,10 @@ if(BUILD_TESTING)
70
65
test_generic_ec_slave
71
66
test /test_generic_ec_slave.cpp
72
67
)
73
- target_include_directories (test_generic_ec_slave PRIVATE include )
68
+ target_include_directories (test_generic_ec_slave PRIVATE
69
+ $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include>
70
+ $< INSTALL_INTERFACE:include/${PROJECT_NAME} >
71
+ )
74
72
target_link_libraries (test_generic_ec_slave
75
73
${PROJECT_NAME}
76
74
)
Original file line number Diff line number Diff line change @@ -33,28 +33,29 @@ add_library(
33
33
SHARED
34
34
src/ec_master.cpp )
35
35
36
- target_include_directories (
37
- ${PROJECT_NAME}
38
- PRIVATE
39
- include
36
+ target_include_directories (${PROJECT_NAME} PUBLIC
37
+ $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include>
38
+ $< INSTALL_INTERFACE:include>
40
39
${ETHERLAB_DIR} /include
41
40
)
42
41
43
- target_link_libraries (${PROJECT_NAME} ${ETHERCAT_LIB} )
44
-
45
- ament_target_dependencies (
46
- ${PROJECT_NAME}
47
- rclcpp
42
+ target_link_libraries (${PROJECT_NAME}
43
+ ${ETHERCAT_LIB}
44
+ rclcpp::rclcpp
48
45
)
49
46
50
47
# INSTALL
51
48
install (
52
49
TARGETS ${PROJECT_NAME}
53
- DESTINATION lib
50
+ EXPORT export_${PROJECT_NAME}
51
+ LIBRARY DESTINATION lib
52
+ ARCHIVE DESTINATION lib
53
+ RUNTIME DESTINATION bin
54
54
)
55
+
55
56
install (
56
57
DIRECTORY include /
57
- DESTINATION include
58
+ DESTINATION include /${PROJECT_NAME}
58
59
)
59
60
60
61
if (BUILD_TESTING )
@@ -79,13 +80,11 @@ if(BUILD_TESTING)
79
80
endif ()
80
81
81
82
## EXPORTS
82
- ament_export_include_directories (
83
- include
84
- )
85
83
ament_export_libraries (
86
84
${PROJECT_NAME}
87
85
${ETHERCAT_LIBRARY}
88
86
)
87
+ ament_export_targets (export_${PROJECT_NAME} HAS_LIBRARY_TARGET )
89
88
ament_export_dependencies (
90
89
rclcpp
91
90
)
Original file line number Diff line number Diff line change @@ -31,8 +31,11 @@ target_include_directories(
31
31
include
32
32
${ETHERLAB_DIR} /include
33
33
)
34
- target_link_libraries (ethercat_sdo_srv_server ${ETHERCAT_LIB} )
35
- ament_target_dependencies (ethercat_sdo_srv_server rclcpp ethercat_msgs )
34
+ target_link_libraries (ethercat_sdo_srv_server PUBLIC
35
+ ${ETHERCAT_LIB}
36
+ rclcpp::rclcpp
37
+ ${ethercat_msgs_TARGETS}
38
+ )
36
39
37
40
if (BUILD_TESTING )
38
41
find_package (ament_lint_auto REQUIRED )
You can’t perform that action at this time.
0 commit comments