ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Not sure if this will be 1:1 applicable to your application, but in my project I've used to have a header-only commons library. What did the trick was to declare all functions in header-only lib as inline such as:

    inline Eigen::Matrix3f rotMatFromQuat(Eigen::Quaternionf quat)
    {
        return quat.toRotationMatrix();
    }

in the external package that you want to use your header-only lib in, put

<depend>header-only_package</depend>

in package.xml, and

find_package(header-only_package REQUIRED)
include_directories("./../header-only_package/include")

in CMakeLists.txt. I know this approach is not the best practice (as it refers to relative path to include dir) but it should work as long as your tree looks something like

- workspace/
--- src/
------- client_package/
------- library_package/
------- header-only_package/