You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using components in the layout method for a dependency module, it seems that what gets defined through self.cpp.package.includedirs, self.cpp.package.libdirs, and so on is ignored when CMake related file are generated by a conan install for a consumer of the module.
For example, consider a layout method of the dependency's Conanfile containing:
self.cpp.package.includedirs = ["inc"]
but no component related definitions.
In this case the conan_toolchain.cmake file generated for a consumer contains something like:
Your observations are right, once components are defined, the global self.cpp_info.xxxdirs are completely ignored, and the components defaults are used instead. So if you want to change the components ones need to do self.cpp_info.components["mycomp"].includedirs = ["inc"] too.
I have tried to make it that way, because it would be a bit more intuitive, in conan-io/conan#13994. But I finally dropped it, too risky, almost impossible to do it without breaking.
Environment details
Description
Hi,
When using components in the
layout
method for a dependency module, it seems that what gets defined throughself.cpp.package.includedirs
,self.cpp.package.libdirs
, and so on is ignored when CMake related file are generated by aconan install
for a consumer of the module.For example, consider a
layout
method of the dependency's Conanfile containing:but no component related definitions.
In this case the
conan_toolchain.cmake
file generated for a consumer contains something like:By adding just any single component related definition to the
layout
method, for example:what gets generated in the consumer's
conan_toolchain.cmake
becomes like this:i.e. with the default
"include"
instead of"inc"
, as if noself.cpp.package.includedirs
had been defined.To get the expected
conan_toolchain.cmake
we need to add the properincludedirs
definition for the component:The same thing is true for
libdirs
,resdirs
and probably others too (I haven't tested them all).I guess this might be the wanted behaviour, even if I expected the global definitions to be concatenated (in case) with the components related ones.
Thank you in advance for any clarification.
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: