ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

What is ament_cmake job?

asked 2020-04-15 16:08:42 -0600

aby gravatar image

updated 2020-04-15 17:18:16 -0600

  1. created a rclcpp package:
  2. removed <depend>ament_cmake</depend> from package.xml
  3. removed find_package(ament_cmake REQUIRED) from CMakeLists.txt

However, the package still builds fine. The question is what does ament_cmake do in the CMakeList.txt exaclty? I thought it makes the colcon builds but I am able to build without it

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-04-19 05:31:32 -0600

marguedas gravatar image

the main role of ament_cmake is to provide CMake macros that will make your job easier when developing multiple packages that depend on each other. None of it is required to build a CMake based ROS package.

An example of such macro is ament_target_dependencies, it condenses the following cmake logic into a single call:

  • target_compile_definitions()
  • target_include_directories()
  • target_link_libraries()
  • setting link flags on the target

Another (the most?) important macro it provides is ament_package. This is what will handle the registration of your package in the ament index, generate the CMake config files for the project to be find_package'able, install the extra CMake config files you provide, install the package.xml of your package etc

You can find some information about ament_cmakein the section "Build type: ament_cmake" of

edit flag offensive delete link more


Thank you for your quick reply. Since we still at it, I have another question about ament. I know that ament_python is for building packages using python's and (for now) users can not mix ament_cmake with ament_python in the same package.

The question is what does ament_cmake_python do? and an explanation with a use-case/example would make me happy.

Sorry, there is just some lack of information/use-cases out there about some of ament functions.

aby gravatar image aby  ( 2020-04-20 12:57:07 -0600 )edit

@aby: please do not post follow-up questions in comments under already accepted answers. Post a new question.

Then refer to your old question in your new question.

gvdhoorn gravatar image gvdhoorn  ( 2020-04-20 13:04:48 -0600 )edit

Sorry, I am new here. I will post a new question. Thanks

aby gravatar image aby  ( 2020-04-20 13:18:07 -0600 )edit

followup question has moved to #q350012.

aby gravatar image aby  ( 2020-04-20 13:24:14 -0600 )edit

Question Tools



Asked: 2020-04-15 16:08:42 -0600

Seen: 1,041 times

Last updated: Apr 19 '20