Skip to content
New issue

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

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

Already on GitHub? # to your account

Make custom_validators accessible from external library #239

Open
christophfroehlich opened this issue Jan 22, 2025 · 0 comments
Open

Make custom_validators accessible from external library #239

christophfroehlich opened this issue Jan 22, 2025 · 0 comments

Comments

@christophfroehlich
Copy link
Collaborator

With #213 it is straightforward to use a complete cpp library within another package. But how can I use a custom_validator file from a different package?

Is there a smarter way to include the file from here to another library than

find_package(control_toolbox)
# get include dirs from control_toolbox for the custom validators
get_target_property(TB_INCLUDE_DIRS control_toolbox::rate_limiter_parameters INTERFACE_INCLUDE_DIRECTORIES)
generate_parameter_library(diff_drive_controller_parameters
  src/diff_drive_controller_parameter.yaml
  ${TB_INCLUDE_DIRS}/control_toolbox/custom_validators.hpp
)

@AugusteBourgois any suggestions?
Changing the macro here to avoid a COPY but just use the correct include path control_toolbox/custom_validators.hpp?

if(${ARGC} EQUAL 3)
cmake_path(SET IN_VALIDATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR})
cmake_path(APPEND IN_VALIDATE_HEADER ${ARGV2})
cmake_path(GET IN_VALIDATE_HEADER FILENAME VALIDATE_HEADER_FILENAME)
cmake_path(SET VALIDATE_HEADER ${LIB_INCLUDE_DIR})
cmake_path(APPEND VALIDATE_HEADER ${VALIDATE_HEADER_FILENAME})
# Copy the header file into the include directory
file(COPY ${IN_VALIDATE_HEADER} DESTINATION ${LIB_INCLUDE_DIR})
# necessary so that #include <param_file.hpp> can be used in the local package (deprecated)
file(COPY ${IN_VALIDATE_HEADER} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include)
endif()

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

No branches or pull requests

1 participant