Skip to content

Make custom_validators accessible from external library #239

Open
@christophfroehlich

Description

@christophfroehlich

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions