# Questions on ament, ament.py, ament\_cmake and dependency resolvers

**URL:** <https://discourse.openrobotics.org/t/questions-on-ament-ament-py-ament-cmake-and-dependency-resolvers/4065>\
**Category:** ROS General\
**Created:** [February 28, 2018, 12:36pm UTC](https://discourse.openrobotics.org/t/questions-on-ament-ament-py-ament-cmake-and-dependency-resolvers/4065 "2018-02-28T12:36:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcadam](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/jcadam/32/1550_2.png) [@jcadam](https://discourse.openrobotics.org/u/jcadam)\
**Post date:** [February 28, 2018, 12:36pm UTC](https://discourse.openrobotics.org/t/questions-on-ament-ament-py-ament-cmake-and-dependency-resolvers/4065/1 "2018-02-28T12:36:29Z")

</div>

I am trying to write ament packages to adopt pieces of code to ament\_cmake. Here is something strange I got.

- It is supposed that ‘ament’ performs like ‘catkin’ with which dependencies could be resolved by declaring in ‘package.xml’. However, it seems that ‘ament’ cannot do this job. In an ‘ament’ package, dependencies should be declared explicitly in CMakeLists.txt with ‘find\_package’ macro. Moreover, \*\_INCLUDE\_DIRS or _\_LIBRARIES variables have to be add into target\_link_() macros explicitly too. Is this designed on purpose?

- An ‘ament’ package could be compiled by ‘ament.py’ with ‘build\_pkg’ parameter. It seems that the python script actually doesn’t check whether its dependencies are built. It this what could be expected? I am just using it in a wrong way?

---

<div class="post-metadata">

**Author:** ![gavanderhoorn](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/gavanderhoorn/32/969_2.png) [@gavanderhoorn](https://discourse.openrobotics.org/u/gavanderhoorn)\
**Post date:** [February 28, 2018, 12:50pm UTC](https://discourse.openrobotics.org/t/questions-on-ament-ament-py-ament-cmake-and-dependency-resolvers/4065/2 "2018-02-28T12:50:58Z")

</div>

> [@jcadam](#):
>
> - It is supposed that ‘ament’ performs like ‘catkin’ with which dependencies could be resolved by declaring in ‘package.xml’. However, it seems that ‘ament’ cannot do this job.

just responding to the above bit: Catkin does not resolve dependencies using the package manifest. That would be `rosdep`’s job.

This is also the reason why you have to declare dependencies _twice_: once in your manifest, and once in the `find_package(catkin .. COMPONENTS ..)` call in your build script.

---

<div class="post-metadata">

**Author:** ![jcadam](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/jcadam/32/1550_2.png) [@jcadam](https://discourse.openrobotics.org/u/jcadam)\
**Post date:** [February 28, 2018, 1:11pm UTC](https://discourse.openrobotics.org/t/questions-on-ament-ament-py-ament-cmake-and-dependency-resolvers/4065/3 "2018-02-28T13:11:13Z")

</div>

> > Catkin does not resolve dependencies using the package manifest. That would be rosdep’s job.

Is there a tool in ‘ament’ like ‘rosdep’ ?

---

<div class="post-metadata">

**Author:** ![dirk-thomas](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/dirk-thomas/32/4328_2.png) [@dirk-thomas](https://discourse.openrobotics.org/u/dirk-thomas)\
**Post date:** [February 28, 2018, 6:19pm UTC](https://discourse.openrobotics.org/t/questions-on-ament-ament-py-ament-cmake-and-dependency-resolvers/4065/4 "2018-02-28T18:19:20Z")

</div>

> [@jcadam](#):
>
> Is this designed on purpose?

Yes, using the `COMPONENTS` keyword when finding catkin to enumerate additional packages has several drawbacks and was therefore not provided in `ament_cmake`.

To maintain a similar level of convenience as in `catkin` you can call [ament\_target\_dependencies(…)](https://github.com/ament/ament_cmake/blob/af0789c46d03aabf6ee2cae360bf0487dd8a84d4/ament_cmake_target_dependencies/cmake/ament_target_dependencies.cmake#L31) after finding all packages separately. The function will do the “heavy lifting” for you and “use” all common variables from the package names you pass for the passed target name.

> [@jcadam](#):
>
> An ‘ament’ package could be compiled by ‘ament.py’ with ‘build\_pkg’ parameter. It seems that the python script actually doesn’t check whether its dependencies are built. It this what could be expected?

It does exactly what you described - it builds only the single one package. It does _not_ build any other packages. You should use `build` for that. `build_pkg` should commonIy not be used by users.

> [@jcadam](#):
>
> Is there a tool in ‘ament’ like ‘rosdep’ ?

ROS 2 uses `rosdep` the same as ROS 1 does.
