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

Why need to parse package.xml to build/<pkg>/ament_cmake_code/package.cmake?

asked 2019-06-12 02:00:36 -0500

Left4taco gravatar image

updated 2019-06-12 08:57:45 -0500

I'm reading the source code of ament_cmake now. The omnipresent ament_package() CMake function calls ament_package_xml, which parses the package.xml into build/<pkg>/ament_cmake_code/package.cmake, and then include this file. The content of which is like:

set(rcl_VERSION "0.6.4")
set(rcl_MAINTAINER "William Woodall <>")
set(rcl_BUILD_DEPENDS "rcl_interfaces" "rcutils" "rosidl_generator_c" "rmw_implementation")
set(rcl_BUILDTOOL_DEPENDS "ament_cmake_ros")
set(rcl_BUILD_EXPORT_DEPENDS "rmw" "rcl_interfaces" "rcutils" "rosidl_generator_c" "rmw_implementation")
set(rcl_EXEC_DEPENDS "ament_cmake" "rcutils" "rosidl_default_runtime" "rmw_implementation")
set(rcl_TEST_DEPENDS "ament_cmake_gtest" "ament_cmake_ros_isolated_gtest" "ament_cmake_pytest" "ament_lint_auto" "ament_lint_common" "rmw" "rmw_implementation_cmake" "launch" "osrf_testing_tools_cpp" "std_msgs" "test_msgs")
set(rcl_GROUP_DEPENDS "rcl_logging_packages")
set(rcl_DEPRECATED "")
list(APPEND rcl_EXPORT_TAGS "<build_type>ament_cmake</build_type>")

But I didn't see any variable in this file being used later. And also, shouldn't it be colcon's responsibility to parse the xml and calculate the dependency graph?

Could you guys please show me the purpose of this file? Thanks.

One late finding is that, these <pkg>_EXEC_DEPENDS. <pkg>_BUILDTOOL_EXPORT_DEPENDS, etc., are only used in ament_auto_packages. Is that the reason why this package.cmake exists?

edit retag flag offensive close merge delete


It is not necessary to use colcon to build ament packages. You can use the standard cmake .. && make && make install paradigm without colcon installed and all of the system will work.

As you're just learning about the system I suggest that you reword your question to be a little less confrontational and you might find people more willing to take the time to help you understand the intricacies of how things work that you might not see in the first read through.

tfoote gravatar image tfoote  ( 2019-06-12 03:13:43 -0500 )edit

Appreciate that. Thanks

Left4taco gravatar image Left4taco  ( 2019-06-12 08:56:23 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-06-12 10:29:15 -0500

Dirk Thomas gravatar image

These variables are used in many places - just a few examples:

edit flag offensive delete link more


Thanks Dirk. That's very helpful.

Left4taco gravatar image Left4taco  ( 2019-06-12 11:10:14 -0500 )edit

Question Tools



Asked: 2019-06-12 02:00:36 -0500

Seen: 243 times

Last updated: Jun 12 '19