CMakeLists.txt是CMake的构建系统构建软件包的输入文件。任何兼容的CMake都包含了描述如何构建代码,并在根目录及子目录进行安装到一个或多个的CMakeLists.txt文件。
-
Required CMake Version (cmake_minimum_required)//cmake版本
-
Package Name (project()) //项目名称
-
Find other CMake/Catkin packages needed for build (find_package()) //需要的库文件,调用ROS,至少需要catkin的依赖库
-
Message/Service/Action Generators (add_message_files(), add_service_files(), add_action_files()) //输出的信息,服务,及生成的东西
-
Invoke message/service/action generation (generate_messages()) //生成信息~~~
-
Specify package build info export (catkin_package()) //catkin的库文件
-
Libraries/Executables to build (add_library()/add_executable()/target_link_libraries()) //库文件,生成文件及路径
-
Tests to build (catkin_add_gtest())
-
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 -