Ament Cmake with header only library
I want to make a header only cpp library for use in ROS nodes and build it with ament such that it is indexed properly and ament_target_dependency finds it and propagates transitive flags. Here's my current setup:
In package foolib, CMakeLists.txt includes the following lines
add_library(foo INTERFACE include/foolib/foo.h)
set_target_properties(foo PROPERTIES CXX_STANDARD 20)
set_target_properties(foo PROPERTIES
INTERFACE_LINK_DEPENDS stdc++fs
)
ament_export_libraries(
foo
)
However, the install/foolib/lib
folder contains no header files. Nor does any other folder under install/foolib
, and the header is not copied (or symlinked) to any dependent projects. The header is nowhere in build/
or install/
. The only way I can get the header file to get installed is to manually specify the include folder, which copies the whole include folder. This makes the header file appear, but since it's just a header file and not a CMake target, there's no information on what dependencies it has or what any specializations need to link (in this case, anyone that uses foo
needs to link toward stdc++fs
). Is this solvable with ament?