Closed mzbro closed 2 weeks ago
Hi @mzbro
Thanks for your question.
Headers are not transitive by default, the expectation is that dependencies are implementation details. There are 2 possibilities:
test_package
has a direct #include
to one header of the transitive package, then the consumer should declare a direct requires
to the package, as it depends directly on it.#include
in its public headers other headers from the dependency, then it is propagating the include requirements, and as it is not the default visibility, it should be declared in the requires with self.requires("pkg/version", transitive_headers=True)
Please let us know if that helps.
Adding transitive_headers=True
to my example project solved this issue. Thank you very much! I must have missed that in the tutorial.
Happy to help.
The truth is that the basic tutorial doesn't cover this transitivity, it is a bit more advanced case, we might try to add some hints or links there.
Thanks for the feedback!
Hi! I would like to create a package, which uses a local header only library package. To simplify the problem, I've used an example from official conan repository (package "sum"):
Official header only example
Next, I have created a package from cmake_lib template, which requires sum:
I have uploaded my project to illustrate this issue: https://github.com/mzbro/conan-header-only/tree/main
Problem description
My
example
project can access headersum.h
, but the header is not available for myexample/test_package
test. I have compared generated *.cmake files, and there is one diff for sum's cmake files:The one for test_package misses
"${sum_PACKAGE_FOLDER_RELEASE}/include"
for includes.Is this a bug, or am I missing something in my recipes?
Platform description
conan version:
2.4.1
OS: Ubuntu 22.04.4 LTS (amd64) - edited Compiler: gcc 11.4.0 Host: native (bare metal)Have you read the CONTRIBUTING guide?