[question] Components hide global definitions in layout method
- Dominant language
- C++
- Stars
- 125
- Forks
- 382
- Avg merge
- 22h 39m
- Merged PRs (30d)
- 21
Description
### Environment details
* Conan version: **2.0.17**
* Python version: **3.11.6**
### Description
Hi,
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:
```
list(PREPEND CMAKE_INCLUDE_PATH "C:/c2/b/depenf073120889728/p/inc")
```
By adding just any single component related definition to the `layout` method, for example:
```
self.cpp.package.components["comp"].objects = ["crt0_comp"]
```
what gets generated in the consumer's `conan_toolchain.cmake` becomes like this:
```
list(PREPEND CMAKE_INCLUDE_PATH "C:/c2/b/depen532f33fab3b55/p/include")
```
i.e. with the default `"include"` instead of `"inc"`, as if no `self.cpp.package.includedirs` had been defined.
To get the expected `conan_toolchain.cmake` we need to add the proper `includedirs` definition for the component:
```
self.cpp.package.components["comp"].includedirs = ["inc"]
```
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?
- [x] I've read the CONTRIBUTING guide
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.