Ask Your Question

Using a_pkg cmake extras in b_pkg cmake extras

asked 2016-03-14 02:37:36 -0500

demmeln gravatar image

updated 2016-03-14 02:38:46 -0500

I have a situation where I want to use CMake macros defined in a_pkg cmake extras (defined via CFG_EXTRAS) in b_pkg's cmake extras.

For this, in b_pkg I define a buildtool_export_depend on a_pkg. If I then try to build c_pkg with an buildtool_depend on b_pkg, it fails, since while trying to load the cmake extras from b_pkg the macro from a_pkg's extras is not found.

It makes sense why this would happen, since nowhere does anyone call find_package on a_pkg. But what is the correct way to deal with this?

Does it make sense to manually call find_package(a_pkg REQUIRED) in b_pkg's cmake extras file, or should there be another mechanism? Note that I do not buildtool_depend or build_depend on a_pkg in b_pkg, and therefore also don't call find_package(catkin ...) with a_pkg in the component list.

Here are the example packages:

Note: Try the example package with catkin_make, since catkin build seems to have an issue with buildtool_export_depend , see

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-03-14 03:03:39 -0500

William gravatar image

Based on your description, I'd say you need to buildtool_export_depend on a_pkg in b_pkg's package.xml (as you appear to already have done) and you need find_package(a_pkg REQUIRED) in the extras file of b_pkg before you use something from it.

edit flag offensive delete link more


Would this be the place to add according documentation?

demmeln gravatar image demmeln  ( 2016-03-14 08:31:21 -0500 )edit

Sorry, didn't see this comment right off. I guess that would be as good of a place as any to put a note about this pattern. The other option would be to describe the pattern here:

William gravatar image William  ( 2016-03-16 13:08:01 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2016-03-14 02:37:36 -0500

Seen: 87 times

Last updated: Mar 14 '16