[CMake] Transitive dependencies of header libraries

Alberto Luaces aluaces at udc.es
Fri Sep 29 07:40:36 EDT 2017


Hi, I have a header-only library which itself depends on another
header-only library:

```
add_library(myheaderonlylib INTERFACE)

target_include_directories(myheaderonlylib INTERFACE
  $<INSTALL_INTERFACE:include/myheaderonlylib>
  )

target_link_libraries(myheaderonlylib INTERFACE Eigen3::Eigen)

install(TARGETS myheaderonlylib EXPORT myheaderonlylib-config DESTINATION include)

install(EXPORT myheaderonlylib-config DESTINATION share/myheaderonlylib/cmake)
```

When a third library links to "myheaderonlylib", cmake adds the target
 Eigen3::Eigen, but since it is not known there, the configuration step
 fails.

I understand this is a difficult one, but I wonder if there is any other
way instead of finding Eigen3::Eigen from the client package.

Thanks!

-- 
Alberto



More information about the CMake mailing list