conan-io / conan-io/docs

[question] Profiles: apply package selector for [conf] section / Recipe: custom build folder layout per package

Open
#3,504 2 comments 0 reactions 1 assignee Claimed by @memsharded View on GitHub
stage: triaging
Dominant language
C++
Stars
125
Forks
382
Avg merge
22h 39m
Merged PRs (30d)
21

Description

### What is your question?

Hello,
I'm developing a library package and would like to work with a custom build folder layout.
Goal is the simultaneous development of multiple architectures within a single IDE instance.
For now, I want this custom build folder layout only to be applied within my project without worrying about breaking other peoples stuff.

First I tried with `cmake_layout`s build_folder argument inside my recipe.
This had the drawback that for two architectures, the generated cmake user presets ended up with the same name.

Finally, I figured out that `tools.cmake.cmake_layout:build_folder_vars` does what I want.
I end up with a build folder like: `build/` and a configure preset named ``.
Unfortunately I found no way to specify this setting inside my recipe only.
So I had to put it into my profiles.

**cross**
```ini
[settings]
arch=armv8
# ...
[conf]
mypackage:tools.cmake.cmake_layout:build_folder_vars=["settings.arch"]
mypackage:tools.cmake.cmaketoolchain:generator="Ninja Multi-Config"
```

**native**
```ini
[settings]
arch=x86_64
# ...
[conf]
mypackage:tools.cmake.cmake_layout:build_folder_vars=["settings.arch"]
mypackage:tools.cmake.cmaketoolchain:generator="Ninja Multi-Config"
```

Here I encountered two problems:
1. Limiting the elements of the `[conf]` section to my package does not seem to be recognized (Possibly due to two colons). Not limiting it to my package affects the build folder layout of others.
2. Everytime I build my package, I need to ensure that the users profile has this settings set.

**Is there a way to specify `tools.cmake.cmake_layout:build_folder_vars` only for my recipe without the manipulation of profiles?**

### 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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.