在文件CMakelists.txt中我看到find_packages和catkin_package:
find_package(catkin REQUIRED COMPONENTS roscpp rospy
image_transport std_msgs message_generation sensor_msgs
geometry_msgs)catkin_package(CATKIN_DEPENDS message_runtime std_msgs sensor_msgs geometry_msgs)
这两件事有什么区别?
我试着阅读教程中的每一件事,但还不够清楚。
答案 0 :(得分:1)
答案基本上由CMakeLists.txt
:
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS ...
和
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you 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(...
find_package
命令是常见的cmake,需要加载catkin宏并指定其他ROS包的依赖关系。
catkin_package
命令是其中一个catkin宏。
它负责包的ROS特定配置。因此,这是将ROS包与常见的cmake项目区分开来的重要部分。我不知道细节,但我想它是负责设置catkin工作区的正确构建路径。
当其他ROS包依赖于此时,这里给出的参数(即依赖性)很重要。
答案 1 :(得分:0)
find_package()
查找此程序包的依赖项。
catkin_package(CATKIN_DEPENDS)
声明依赖于此程序包的程序包的依赖关系。
因此,在您的示例中,取决于您的软件包的任何软件包都需要以下依赖项:
message_runtime
std_msgs
sensor_msgs
geometry_msgs