ROS CMakeLists.txt的编写

 CMakeLists.txtCMake的构建系统构建软件包的输入文件任何兼容的CMake包含了描述如何构建代码,并在根目录及子目录进行安装到一个或多个的CMakeLists.txt文件。


  1. Required CMake Version (cmake_minimum_required)//cmake版本

  2. Package Name (project()) //项目名称

  3. Find other CMake/Catkin packages needed for build (find_package()) //需要的库文件,调用ROS,至少需要catkin的依赖库

  4. Message/Service/Action Generators (add_message_files(), add_service_files(), add_action_files()) //输出的信息,服务,及生成的东西

  5. Invoke message/service/action generation (generate_messages()) //生成信息~~~

  6. Specify package build info export (catkin_package()) //catkin的库文件

  7. Libraries/Executables to build (add_library()/add_executable()/target_link_libraries()) //库文件,生成文件及路径

  8. Tests to build (catkin_add_gtest())

  9. Install rules (install())

find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs message_generation)

add_message_files(
  FILES
  Num.msg
)

generate_messages(
  DEPENDENCIES
  std_msgs
)

修改完以后,需要重新编译我们的package

$ roscd beginner_tutorials
$ cd ../..
$ catkin_make install
$ cd -


猜你喜欢

转载自blog.csdn.net/try_again_later/article/details/79983829