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

How to include the parameters in a dependent package? #204

Open
reinzor opened this issue May 30, 2024 · 5 comments
Open

How to include the parameters in a dependent package? #204

reinzor opened this issue May 30, 2024 · 5 comments

Comments

@reinzor
Copy link

reinzor commented May 30, 2024

Hi,

Thanks for this library!

We would like to include a public header from another packages that includes the parameter header. However, this header is not available for that package as #include <example_parameters.hpp> but it is installed under example_parameters/example_parameters.hpp. How can we do this?

So the setup:

package_with_parameters/include/header.hpp

#include <example_parameters.hpp>

another_package/include/header.hpp

#include <package_with_parameters/header.hpp> // #include <example_parameters.hpp> cannot be found, example_parameters/example_parameters.hpp can be found

Can you help us with this?

@christophfroehlich
Copy link
Collaborator

christophfroehlich commented May 30, 2024

I found a way to install the created headers

project(steering_controllers_library LANGUAGES CXX)

generate_parameter_library(limiters_parameters
  src/limiters_parameters.yaml
)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/limiters_parameters/include/limiters_parameters.hpp
  DESTINATION include/${PROJECT_NAME}/${PROJECT_NAME})

and now another package can include it via

#include "steering_controllers_library/limiters_parameters.hpp"

But there is for sure a smarter way. Maybe someone with knowledge in CMake can enlighten us ;)

@reinzor
Copy link
Author

reinzor commented May 31, 2024

Thanks for your quick response.

Including the parameter file via another package already works. The problem here is that the include is different for the package that holds defines the parameters and a dependent package. This include:

#include "steering_controllers_library/limiters_parameters.hpp"

is not being resolved correctly by the package itself. There, it is available as

#include "limiters_parameters.hpp"

Or am I missing something?

@christophfroehlich
Copy link
Collaborator

That's how I use it now.
but 👀 #180

@reinzor
Copy link
Author

reinzor commented May 31, 2024

Thanks! This would indeed allow for including a header that includes the parameter header in another package.

@AugusteBourgois
Copy link
Contributor

Hi everyone, PR #213 should fix the issue. It's on a fork right now, but can hopefully be merged soon. Open to discussion anyway.

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

3 participants