ROS包中的 CMakeLists.txt 文件翻译

cmake_minimum_required(VERSION 3.0.2)   #  所需 cmake 版本
project(ros02_hello_vscode)             #  包名称,会被 ${PROJECT_NAME} 的方式调用

## Compile as C++11, supported in ROS Kinetic and newer
## 编译为C++11,在ROS和更新版本中受支持 
# add_compile_options(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
##  查找catkin宏和库
##  如果组件列表如find_package(catkin所需组件xyz)
##  是用过的,还可以找到其他的catkin包

#  设置构建所需要的软件包
find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  geometry_msgs
  message_generation
)

## System dependencies are found with CMake's conventions
#  默认添加系统依赖
# find_package(Boost REQUIRED COMPONENTS system)


## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## 如果包具有setup.py,则取消对此的注释。此宏确保安装其中声明的模块和全局脚本
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
#  启动 python 模块支持
# catkin_python_setup()

################################################
## Declare ROS messages, services and actions ##
##           声明 ROS 消息、服务、动作           ##
################################################


## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
##   your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
##   * add a build_depend tag for "message_generation"
##   * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
##   * If MSG_DEP_SET isn't empty the following dependency has been pulled in
##     but can be declared for certainty nonetheless:
##     * add a exec_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
##   * add "message_generation" and every package in MSG_DEP_SET to
##     find_package(catkin REQUIRED COMPONENTS ...)
##   * add "message_runtime" and every package in MSG_DEP_SET to
##     catkin_package(CATKIN_DEPENDS ...)
##   * uncomment the add_*_files sections below as needed
##     and list every .msg/.srv/.action file to be processed
##   * uncomment the generate_messages entry below
##   * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
##  要在此包中声明和生成消息、服务或操作,请执行以下步骤: 
##  *MSG_DEP_SET是您在中使用其消息类型的包集
##  您的消息/服务/操作(例如std_msgs、actionlib_msgs等)。
##  *在package.xml文件中:
##  *为“消息生成”添加构建依赖标记
##  *为MSG_DEP_SET中的每个包添加build_depend和exec_depend标记
##  *如果MSG_DEP_SET不为空,则已拉入以下依赖项
##  但可以肯定地宣布:
##  *为“消息运行时”添加exec_dependen标记
##  *在此文件(CMakeLists.txt)中:
##  *添加“消息生成”并将MSG_DEP_中的每个包设置为
##  查找包装(catkin所需组件…)
##  *添加“message_runtime”并将MSG_DEP_中的每个包设置为
##  柳絮包装(catkin包装视情况而定)
##  *根据需要取消注释下面的“添加文件”部分
##  并列出要处理的每个.msg/.srv/.action文件
##  *取消注释下面的generate_messages条目
##  *在MSG_DEP_SET中添加每个包以生成_消息(依赖项…)

# Generate messages in the 'msg' folder
# 在“msg”文件夹中生成消息 
add_message_files(
  FILES
  Topic.msg
)

## Generate services in the 'srv' folder
##  在“srv”文件夹中生成服务
# add_service_files(
#   FILES
#   Service1.srv
#   Service2.srv
# )

## Generate actions in the 'action' folder
## 在“action”文件夹中生成操作
# add_action_files(
#   FILES
#   Action1.action
#   Action2.action
# )

## Generate added messages and services with any dependencies listed here
# 生成消息、服务时的依赖包
generate_messages(
  DEPENDENCIES
  geometry_msgs
  std_msgs
)

################################################
## Declare ROS dynamic reconfigure parameters ##
##          声明 ROS 动态参数配置                ##
################################################

## To declare and build dynamic reconfigure parameters within this
## package, follow these steps:
## * In the file package.xml:
##   * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
## * In this file (CMakeLists.txt):
##   * add "dynamic_reconfigure" to
##     find_package(catkin REQUIRED COMPONENTS ...)
##   * uncomment the "generate_dynamic_reconfigure_options" section below
##     and list every .cfg file to be processed
##  若要在此包范围内声明和生成动态重新配置参数,请执行以下操作:
##  *在package.xml文件中:
##  *为“动态重新配置”添加构建依赖和执行依赖标记
##  *在此文件(CMakeLists.txt)中:
##  *将“dynamic_reconfigure”添加到
##  查找包装(catkin所需组件…)
##  *取消注释下面的“generate_dynamic_reconfigure_options”部分
##  并列出要处理的每个.cfg文件

## Generate dynamic reconfigure parameters in the 'cfg' folder
##  在“cfg”文件夹中生成动态重新配置参数 
# generate_dynamic_reconfigure_options(
#   cfg/DynReconf1.cfg
#   cfg/DynReconf2.cfg
# )

###################################
## catkin specific configuration ##
##      catkin 特定配置           ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if your package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
##  catkin_package宏为包生成cmake配置文件
##  声明要传递给依赖项目的内容
##  INCLUDE_DIRS:如果packages包含头文件,请取消对此的注释
##  库:在此项目中创建的依赖项目也需要的库
##  CATKIN_DEPENDS:依赖CATKIN_packages的项目也需要
##  依赖项:依赖项目也需要的此项目的系统依赖项 

# 运行时依赖
catkin_package(
  INCLUDE_DIRS include
  LIBRARIES hello_vscode
  CATKIN_DEPENDS roscpp rospy std_msgs geometry_msgs
  DEPENDS system_lib
  message_runtime
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
# 添加头文件路径,当前程序包的头文件路径位于其他文件路径之前
include_directories(
# include
  ${catkin_INCLUDE_DIRS}
)

## Declare a C++ library
# 声明 C++ 库
# add_library(${PROJECT_NAME}
#   src/${PROJECT_NAME}/hello_vscode.cpp
# )

## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
# 添加库的 cmake 目标依赖
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
# 声明 C++ 可执行文件
add_executable(hello_vs_c src/hello_vs_c.cpp)
add_executable(ssy_c src/ssy_c.cpp)

## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
## target back to the shorter version for ease of user use
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
#  重命名c++可执行文件
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")

## Add cmake target dependencies of the executable
## same as for the library above
#  添加可执行文件的 cmake 目标依赖
add_dependencies(ssy_c ${PROJECT_NAME}_generate_messages_cpp)

## Specify libraries to link a library or executable target against
#  指定库、可执行文件的链接库
target_link_libraries(hello_vs_c
  ${catkin_LIBRARIES}
)
target_link_libraries(ssy_c
  ${catkin_LIBRARIES}
)

#############
## Install 安装 ##
#############

# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html

## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
#  设置用于安装的可执行脚本
catkin_install_python(PROGRAMS
  scripts/hello_vscode_p.py
  DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

## Mark executables for installation
# 标记要安装的可执行文件
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html
# install(TARGETS ${PROJECT_NAME}_node
#   RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark libraries for installation
##  标记要安装的库
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
# install(TARGETS ${PROJECT_NAME}
#   ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
#   LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
#   RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
# )

## Mark cpp header files for installation
##  标记要安装的cpp头文件
# install(DIRECTORY include/${PROJECT_NAME}/
#   DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
#   FILES_MATCHING PATTERN "*.h"
#   PATTERN ".svn" EXCLUDE
# )

## Mark other files for installation (e.g. launch and bag files, etc.)
##  标记要安装的其他文件(例如,启动和打包文件等) 
# install(FILES
#   # myfile1
#   # myfile2
#   DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )

#############
## Testing ##
#############

## Add gtest based cpp test target and link libraries
## 添加基于gtest的cpp测试目标和链接库 
# catkin_add_gtest(${PROJECT_NAME}-test test/test_hello_vscode.cpp)
# if(TARGET ${PROJECT_NAME}-test)
#   target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()

## Add folders to be run by python nosetests
## 添加要由python测试运行的文件夹 
# catkin_add_nosetests(test)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值