Can you structure the include folder in a ROS C++ Package with subfolders?

1.1k views Asked by At

I currently have some c++ libraries that i would like to implement and build in ROS using catkin workspaces. My method so far has been to let each library be its own package, but I've recently run into a problem of circular dependencies with the packages. My approach to fix this has been to implement the libraries within a single package, but i somehow wish to keep the libraries separated and i therefore wonder if it is possible to structure the include folder for a ROS c++ package with subfolders?

The idea would look something like this


--catkin_ws
  --src
    --my_package
      --include
        --library_1
          someheaderfile.h
        --library_2
          someotherheaderfile.h
            ..
      --src
        --library_1
          somecppfile.cpp
        --library_2
          someothercppfile.cpp
      CMakelists.txt
      package.xml

I guess my main concern lies within breaking the catkin structure needed for proper compilation.

Thanks!

1

There are 1 answers

0
Paal Arthur S. Thorseth On BEST ANSWER

Solved:

As long as you properly structure your CMakeLists.txt with respect to the guide presented here: http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html, and your subdirectories lie within include/my_package/ everything works fine.