[ros-users] [Discourse.ros.org] [Next Generation ROS] Make Ament work with another build system (for cross-compilation)

Dirk Thomas ros.discourse at gmail.com
Thu Aug 10 16:11:22 UTC 2017



`ament_package()` internally calls `ament_package_xml()` which is responsible to parse the `package.xml` file and defined CMake variables for various parts. You can either access the variables after the `ament_package()` call or manually invoke `ament_package_xml()` anytime before to get the information earlier.

The [package_xml_2_cmake.py](https://github.com/ament/ament_cmake/blob/master/ament_cmake_core/cmake/core/package_xml_2_cmake.py) script is responsible to extract the majority of the information. You can also look at the generated CMake code for a specific folder - in each package build folder you find a file name `ament_cmake_core/package.cmake`. It contains all the CMake variables defined for the package, e.g. variable for the package name, version, maintainer, all the dependency types, version, export tags, etc.

As an example the generated `package.cmake` file for the `ament_index_cpp` package looks like this:

```
set(_AMENT_PACKAGE_NAME "ament_index_cpp")
set(ament_index_cpp_VERSION "0.0.2")
set(ament_index_cpp_MAINTAINER "Dirk Thomas <dthomas at osrfoundation.org>")
set(ament_index_cpp_BUILD_DEPENDS )
set(ament_index_cpp_BUILDTOOL_DEPENDS "ament_cmake")
set(ament_index_cpp_BUILD_EXPORT_DEPENDS )
set(ament_index_cpp_BUILDTOOL_EXPORT_DEPENDS )
set(ament_index_cpp_EXEC_DEPENDS )
set(ament_index_cpp_TEST_DEPENDS "ament_cmake_gtest" "ament_lint_auto" "ament_lint_common")
set(ament_index_cpp_DEPRECATED "")
set(ament_index_cpp_EXPORT_TAGS)
list(APPEND ament_index_cpp_EXPORT_TAGS "<build_type>ament_cmake</build_type>")
```





---
[Visit Topic](https://discourse.ros.org/t/make-ament-work-with-another-build-system-for-cross-compilation/2382/8) or reply to this email to respond.




More information about the ros-users mailing list