Created
October 16, 2016 07:12
-
-
Save jacknlliu/a37692ae0f3f6ffa462467afcd7a2a1d to your computer and use it in GitHub Desktop.
ROS Project CMakeLists.txt template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| project(package_name) | |
| ## Find catkin macros and libraries, also find other catkin packages | |
| find_package(catkin REQUIRED COMPONENTS | |
| roscpp | |
| rospy | |
| std_msgs | |
| message_generation | |
| ) | |
| ## Declare ROS messages, services and actions ## | |
| ## Generate messages in the 'msg' folder | |
| add_message_files( | |
| FILES | |
| Message1.msg | |
| Message2.msg | |
| ) | |
| ## Generate services in the 'srv' folder | |
| add_service_files( | |
| FILES | |
| Service1.srv | |
| Service2.srv | |
| ) | |
| ## Generate actions in the 'action' folder | |
| add_action_files( | |
| FILES | |
| Action1.action | |
| Action2.action | |
| ) | |
| ## Generate added messages and services with any dependencies listed here | |
| generate_messages( | |
| DEPENDENCIES | |
| std_msgs | |
| ) | |
| ## catkin specific configuration ## | |
| catkin_package( | |
| # INCLUDE_DIRS include | |
| # LIBRARIES package_name | |
| # CATKIN_DEPENDS roscpp rospy std_msgs | |
| # DEPENDS system_lib | |
| CATKIN_DEPENDS | |
| message_runtime | |
| ) | |
| ## Build ## | |
| ## Specify additional locations of header files | |
| include_directories( | |
| include # the path is <package_name>/include | |
| ${catkin_INCLUDE_DIRS} | |
| ) | |
| ## Declare a C++ executable, the .cpp is what the executable program need | |
| add_executable(add_two_ints_server src/add_two_ints_server.cpp) | |
| ## Specify libraries to link a library or executable target against | |
| target_link_libraries(add_two_ints_server ${catkin_LIBRARIES}) | |
| ## Add cmake target dependencies of the executable, keep the program after the target will be built first | |
| add_dependencies(add_two_ints_server package_name_gencpp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment