1. 程序在cmake编译是这样的流程, cmake指令依据你的CMakeLists.txt 文件,生成makefiles文件,make再依据此makefiles文件编译链接生成可执行文件.
  2. catkin_make是将cmakemake的编译方式做了一个封装的指令工具, 规范了工作路径与生成文件路径.

1) cmake标准流程

  1. 1. # 在一个CMake项目里
  2. 2. $ mkdir build
  3. 3. $ cd build
  4. 4. $ cmake ..
  5. 5. $ make
  6. 6. $ make install # (可选)

2) catkin_make 的流程

  1. 1. # In a catkin workspace
  2. 2. $ catkin_make
  3. 3. $ catkin_make install # (可选)
  4. 4.
  5. 5.
  6. 6. 如果源码不在默认工作空间,需要指定编译路径:
  7. 7.
  8. 8. # In a catkin workspace
  9. 9. $ catkin_make --source my_src
  10. 10. $ catkin_make install --source my_src # (optionally)

3、catkin_make默认的路径信息

  1. 1. catkin_make运行后终端输出文件部分解析
  2. 2.
  3. 3. #基本路径
  4. 4. Base path: /home/user/catkin_ws
  5. 5. Source space: /home/user/catkin_ws/src
  6. 6. Build space: /home/user/catkin_ws/build
  7. 7. Devel space: /home/user/catkin_ws/devel
  8. 8. Install space: /home/user/catkin_ws/install
  9. 9.
  10. 10.
  11. 11. #catkin_make 封装运行中cmake运行的情况
  12. 12. Running command: "cmake /home/user/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/user/catkin_ws/devel
  13. 13. -DCMAKE_INSTALL_PREFIX=/home/user/catkin_ws/install" in "/home/user/catkin_ws/build"
  14. 14.
  15. 15. #编译工具查找
  16. 16. -- Using CATKIN_DEVEL_PREFIX: /tmp/catkin_ws/devel
  17. 17. -- Using CMAKE_PREFIX_PATH: /opt/ros/groovy
  18. 18. -- This workspace overlays: /opt/ros/groovy
  19. 19.
  20. 20. #编译的包
  21. 21. <pre name="code" class="cpp">#catkin_make 封装运行中make运行的情况