|
1 |
| -cmake_minimum_required(VERSION 2.8.3) |
2 |
| -project(chatter_listener) |
3 |
| - |
4 |
| -## Compile as C++11, supported in ROS Kinetic and newer |
5 |
| -# add_compile_options(-std=c++11) |
6 |
| - |
7 |
| -## Find catkin macros and libraries |
8 |
| -## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) |
9 |
| -## is used, also find other catkin packages |
10 |
| -find_package(catkin REQUIRED COMPONENTS |
11 |
| - roscpp |
12 |
| - rospy |
13 |
| - std_msgs |
14 |
| - urdf |
15 |
| - controller_manager |
16 |
| - joint_state_controller |
17 |
| - robot_state_publisher |
18 |
| -) |
19 |
| - |
20 |
| -## System dependencies are found with CMake's conventions |
21 |
| -# find_package(Boost REQUIRED COMPONENTS system) |
22 |
| - |
23 |
| - |
24 |
| -## Uncomment this if the package has a setup.py. This macro ensures |
25 |
| -## modules and global scripts declared therein get installed |
26 |
| -## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html |
27 |
| -# catkin_python_setup() |
28 |
| - |
29 |
| -################################################ |
30 |
| -## Declare ROS messages, services and actions ## |
31 |
| -################################################ |
32 |
| - |
33 |
| -## To declare and build messages, services or actions from within this |
34 |
| -## package, follow these steps: |
35 |
| -## * Let MSG_DEP_SET be the set of packages whose message types you use in |
36 |
| -## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). |
37 |
| -## * In the file package.xml: |
38 |
| -## * add a build_depend tag for "message_generation" |
39 |
| -## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET |
40 |
| -## * If MSG_DEP_SET isn't empty the following dependency has been pulled in |
41 |
| -## but can be declared for certainty nonetheless: |
42 |
| -## * add a exec_depend tag for "message_runtime" |
43 |
| -## * In this file (CMakeLists.txt): |
44 |
| -## * add "message_generation" and every package in MSG_DEP_SET to |
45 |
| -## find_package(catkin REQUIRED COMPONENTS ...) |
46 |
| -## * add "message_runtime" and every package in MSG_DEP_SET to |
47 |
| -## catkin_package(CATKIN_DEPENDS ...) |
48 |
| -## * uncomment the add_*_files sections below as needed |
49 |
| -## and list every .msg/.srv/.action file to be processed |
50 |
| -## * uncomment the generate_messages entry below |
51 |
| -## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) |
52 |
| - |
53 |
| -## Generate messages in the 'msg' folder |
54 |
| -# add_message_files( |
55 |
| -# FILES |
56 |
| -# Message1.msg |
57 |
| -# Message2.msg |
58 |
| -# ) |
59 |
| - |
60 |
| -## Generate services in the 'srv' folder |
61 |
| -# add_service_files( |
62 |
| -# FILES |
63 |
| -# Service1.srv |
64 |
| -# Service2.srv |
65 |
| -# ) |
66 |
| - |
67 |
| -## Generate actions in the 'action' folder |
68 |
| -# add_action_files( |
69 |
| -# FILES |
70 |
| -# Action1.action |
71 |
| -# Action2.action |
72 |
| -# ) |
73 |
| - |
74 |
| -## Generate added messages and services with any dependencies listed here |
75 |
| -# generate_messages( |
76 |
| -# DEPENDENCIES |
77 |
| -# std_msgs |
78 |
| -# ) |
79 |
| - |
80 |
| -################################################ |
81 |
| -## Declare ROS dynamic reconfigure parameters ## |
82 |
| -################################################ |
83 |
| - |
84 |
| -## To declare and build dynamic reconfigure parameters within this |
85 |
| -## package, follow these steps: |
86 |
| -## * In the file package.xml: |
87 |
| -## * add a build_depend and a exec_depend tag for "dynamic_reconfigure" |
88 |
| -## * In this file (CMakeLists.txt): |
89 |
| -## * add "dynamic_reconfigure" to |
90 |
| -## find_package(catkin REQUIRED COMPONENTS ...) |
91 |
| -## * uncomment the "generate_dynamic_reconfigure_options" section below |
92 |
| -## and list every .cfg file to be processed |
93 |
| - |
94 |
| -## Generate dynamic reconfigure parameters in the 'cfg' folder |
95 |
| -# generate_dynamic_reconfigure_options( |
96 |
| -# cfg/DynReconf1.cfg |
97 |
| -# cfg/DynReconf2.cfg |
98 |
| -# ) |
99 |
| - |
100 |
| -################################### |
101 |
| -## catkin specific configuration ## |
102 |
| -################################### |
103 |
| -## The catkin_package macro generates cmake config files for your package |
104 |
| -## Declare things to be passed to dependent projects |
105 |
| -## INCLUDE_DIRS: uncomment this if your package contains header files |
106 |
| -## LIBRARIES: libraries you create in this project that dependent projects also need |
107 |
| -## CATKIN_DEPENDS: catkin_packages dependent projects also need |
108 |
| -## DEPENDS: system dependencies of this project that dependent projects also need |
109 |
| -catkin_package( |
110 |
| -# INCLUDE_DIRS include |
111 |
| -# LIBRARIES chatter_listener |
112 |
| -# CATKIN_DEPENDS roscpp rospy std_msgs |
113 |
| -# DEPENDS system_lib |
114 |
| -) |
115 |
| - |
116 |
| -########### |
117 |
| -## Build ## |
118 |
| -########### |
119 |
| - |
120 |
| -## Specify additional locations of header files |
121 |
| -## Your package locations should be listed before other locations |
122 |
| -include_directories( |
123 |
| -# include |
124 |
| - ${catkin_INCLUDE_DIRS} |
125 |
| -) |
126 |
| - |
127 |
| -## Declare a C++ library |
128 |
| -# add_library(${PROJECT_NAME} |
129 |
| -# src/${PROJECT_NAME}/chatter_listener.cpp |
130 |
| -# ) |
131 |
| - |
132 |
| -## Add cmake target dependencies of the library |
133 |
| -## as an example, code may need to be generated before libraries |
134 |
| -## either from message generation or dynamic reconfigure |
135 |
| -# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) |
136 |
| - |
137 |
| -## Declare a C++ executable |
138 |
| -## With catkin_make all packages are built within a single CMake context |
139 |
| -## The recommended prefix ensures that target names across packages don't collide |
140 |
| -# add_executable(${PROJECT_NAME}_node src/chatter_listener_node.cpp) |
141 |
| - |
142 |
| -## Rename C++ executable without prefix |
143 |
| -## The above recommended prefix causes long target names, the following renames the |
144 |
| -## target back to the shorter version for ease of user use |
145 |
| -## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node" |
146 |
| -# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "") |
147 |
| - |
148 |
| -## Add cmake target dependencies of the executable |
149 |
| -## same as for the library above |
150 |
| -# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) |
151 |
| - |
152 |
| -## Specify libraries to link a library or executable target against |
153 |
| -# target_link_libraries(${PROJECT_NAME}_node |
154 |
| -# ${catkin_LIBRARIES} |
155 |
| -# ) |
156 |
| - |
157 |
| -############# |
158 |
| -## Install ## |
159 |
| -############# |
160 |
| - |
161 |
| -# all install targets should use catkin DESTINATION variables |
162 |
| -# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html |
163 |
| - |
164 |
| -## Mark executable scripts (Python etc.) for installation |
165 |
| -## in contrast to setup.py, you can choose the destination |
166 |
| -# install(PROGRAMS |
167 |
| -# scripts/my_python_script |
168 |
| -# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} |
169 |
| -# ) |
170 |
| - |
171 |
| -## Mark executables for installation |
172 |
| -## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html |
173 |
| -# install(TARGETS ${PROJECT_NAME}_node |
174 |
| -# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} |
175 |
| -# ) |
176 |
| - |
177 |
| -## Mark libraries for installation |
178 |
| -## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html |
179 |
| -# install(TARGETS ${PROJECT_NAME} |
180 |
| -# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
181 |
| -# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
182 |
| -# RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} |
183 |
| -# ) |
184 |
| - |
185 |
| -## Mark cpp header files for installation |
186 |
| -# install(DIRECTORY include/${PROJECT_NAME}/ |
187 |
| -# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} |
188 |
| -# FILES_MATCHING PATTERN "*.h" |
189 |
| -# PATTERN ".svn" EXCLUDE |
190 |
| -# ) |
191 |
| - |
192 |
| -## Mark other files for installation (e.g. launch and bag files, etc.) |
193 |
| -# install(FILES |
194 |
| -# # myfile1 |
195 |
| -# # myfile2 |
196 |
| -# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} |
197 |
| -# ) |
198 |
| - |
199 |
| -############# |
200 |
| -## Testing ## |
201 |
| -############# |
202 |
| - |
203 |
| -## Add gtest based cpp test target and link libraries |
204 |
| -# catkin_add_gtest(${PROJECT_NAME}-test test/chatter_listener.cpp) |
205 |
| -# if(TARGET ${PROJECT_NAME}-test) |
206 |
| -# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) |
207 |
| -# endif() |
208 |
| - |
209 |
| -## Add folders to be run by python nosetests |
210 |
| -# catkin_add_nosetests(test) |
| 1 | +cmake_minimum_required(VERSION 3.8) |
| 2 | +project(multiple_chatter_listener) |
| 3 | + |
| 4 | +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
| 5 | + add_compile_options(-Wall -Wextra -Wpedantic) |
| 6 | +endif() |
| 7 | + |
| 8 | +# find dependencies |
| 9 | +find_package(ament_cmake REQUIRED) |
| 10 | +find_package(rclcpp REQUIRED) |
| 11 | +find_package(std_msgs REQUIRED) |
| 12 | +find_package(geometry_msgs REQUIRED) |
| 13 | +# uncomment the following section in order to fill in |
| 14 | +# further dependencies manually. |
| 15 | +# find_package(<dependency> REQUIRED) |
| 16 | +add_executable(talk src/multi_publisher.cpp) |
| 17 | +ament_target_dependencies(talk rclcpp std_msgs geometry_msgs) |
| 18 | + |
| 19 | +add_executable(listen src/multi_subscriber.cpp) |
| 20 | +ament_target_dependencies(listen rclcpp std_msgs geometry_msgs) |
| 21 | + |
| 22 | +install(TARGETS |
| 23 | + talk |
| 24 | + listen |
| 25 | + DESTINATION lib/${PROJECT_NAME}) |
| 26 | + |
| 27 | +if(BUILD_TESTING) |
| 28 | + find_package(ament_lint_auto REQUIRED) |
| 29 | + # the following line skips the linter which checks for copyrights |
| 30 | + # comment the line when a copyright and license is added to all source files |
| 31 | + set(ament_cmake_copyright_FOUND TRUE) |
| 32 | + # the following line skips cpplint (only works in a git repo) |
| 33 | + # comment the line when this package is in a git repo and when |
| 34 | + # a copyright and license is added to all source files |
| 35 | + set(ament_cmake_cpplint_FOUND TRUE) |
| 36 | + ament_lint_auto_find_test_dependencies() |
| 37 | +endif() |
| 38 | + |
| 39 | +ament_package() |
0 commit comments