File tree Expand file tree Collapse file tree 6 files changed +41
-57
lines changed
ethercat_driver_ros2/sphinx/developer_guide
ethercat_generic_cia402_drive Expand file tree Collapse file tree 6 files changed +41
-57
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 @@ -23,38 +23,34 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
23
23
24
24
find_library (ETHERCAT_LIB ethercat HINTS ${ETHERLAB_DIR} /lib )
25
25
26
- ament_export_include_directories (
27
- include
28
- ${ETHERLAB_DIR} /include
29
- )
30
-
31
26
add_library (
32
27
${PROJECT_NAME}
33
28
SHARED
34
29
src/ec_master.cpp )
35
30
36
- target_include_directories (
37
- ${PROJECT_NAME}
38
- PRIVATE
39
- include
31
+ target_include_directories (${PROJECT_NAME} PUBLIC
32
+ $< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include>
33
+ $< INSTALL_INTERFACE:include/${PROJECT_NAME} >
40
34
${ETHERLAB_DIR} /include
41
35
)
42
36
43
- target_link_libraries (${PROJECT_NAME} ${ETHERCAT_LIB} )
44
-
45
- ament_target_dependencies (
46
- ${PROJECT_NAME}
47
- rclcpp
37
+ target_link_libraries (${PROJECT_NAME}
38
+ ${ETHERCAT_LIB}
39
+ rclcpp::rclcpp
48
40
)
49
41
50
42
# INSTALL
51
43
install (
52
44
TARGETS ${PROJECT_NAME}
53
- DESTINATION lib
45
+ EXPORT export_${PROJECT_NAME}
46
+ LIBRARY DESTINATION lib
47
+ ARCHIVE DESTINATION lib
48
+ RUNTIME DESTINATION bin
54
49
)
50
+
55
51
install (
56
52
DIRECTORY include /
57
- DESTINATION include
53
+ DESTINATION include /${PROJECT_NAME}
58
54
)
59
55
60
56
if (BUILD_TESTING )
@@ -79,13 +75,7 @@ if(BUILD_TESTING)
79
75
endif ()
80
76
81
77
## EXPORTS
82
- ament_export_include_directories (
83
- include
84
- )
85
- ament_export_libraries (
86
- ${PROJECT_NAME}
87
- ${ETHERCAT_LIBRARY}
88
- )
78
+ ament_export_targets (export_${PROJECT_NAME} HAS_LIBRARY_TARGET )
89
79
ament_export_dependencies (
90
80
rclcpp
91
81
)
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