Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PRIVATE option to ament_target_dependencies does not work #481

Open
felixf4xu opened this issue Sep 22, 2023 · 1 comment
Open

PRIVATE option to ament_target_dependencies does not work #481

felixf4xu opened this issue Sep 22, 2023 · 1 comment

Comments

@felixf4xu
Copy link

#161 (comment)

PRIVATE and INTERFACE keywords aren't allowed.

I'd like to know why?

If only PUBLIC is allowed and it's used, I can only use public for all other dependencies, even for my PRIVATE library, which leads to a problem.

For example, visualization_msgs is my private library:

ament_target_dependencies(lanelet2_extension_lib PUBLIC
  visualization_msgs
)

but if I don't call

ament_export_dependencies(visualization_msgs) 

The user of my lib package will have this error:

The link interface of target "lanelet2_extension::lanelet2_extension_lib"
  contains:

    visualization_msgs::visualization_msgs__rosidl_generator_c

  but the target was not found.  Possible reasons include:
@clalancette
Copy link
Contributor

I'd like to know why?

Nowadays, INTERFACE is also allowed, but PRIVATE still isn't.

Overall, we are (slowly) moving away from ament_target_dependencies, and instead just use target_link_libraries everywhere. This is one of the reasons; target_link_libraries can do everything that we need, and more. So my suggestion is that for these private dependencies, you switch to using target_link_libraries instead, and then you won't have to export them to downstream consumers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants