Why need to parse package.xml to build/<pkg>/ament_cmake_code/package.cmake?
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(_AMENT_PACKAGE_NAME "rcl")
set(rcl_VERSION "0.6.4")
set(rcl_MAINTAINER "William Woodall <william@osrfoundation.org>")
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_BUILDTOOL_EXPORT_DEPENDS )
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_MEMBER_OF_GROUPS )
set(rcl_DEPRECATED "")
set(rcl_EXPORT_TAGS)
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?
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.
Appreciate that. Thanks