I have two libraries:
a;b: a header-only library which depends ona.
I am not sure if it is possible to link b to a.
If so, how can I do it?
In fact, I have a third library c that depends on both. This CMake script does not work:
[...]
add_library(a ${a_SRC})
target_link_libraries(a CONAN_PKG::<foo>)
add_library(b INTERFACE)
target_sources(b INTERFACE ${b_SRC})
target_include_directories(b INTERFACE "${PROJECT_SOURCE_DIR}/src/include/b/")
target_link_libraries(b INTERFACE a) # This has no effect, I think!
add_executable(c ${c_SRC})
target_link_libraries(c b a)
I used a workaround by adding the source files of a into the definition of c.
[...]
add_executable(c ${c_SRC} ${a_SRC})
[...]