# Presets with Ninja Multi-Config

**URL:** https://discourse.cmake.org/t/presets-with-ninja-multi-config/3793
**Category:** Development
**Tags:** gen:ninja
**Created:** [July 20, 2021, 8:30pm UTC](https://discourse.cmake.org/t/presets-with-ninja-multi-config/3793 "2021-07-20T20:30:03Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![rurabori](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rurabori/32/1651_2.png) [@rurabori](https://discourse.cmake.org/u/rurabori)
#### Post date: [July 20, 2021, 8:30pm UTC](https://discourse.cmake.org/t/presets-with-ninja-multi-config/3793/1 "2021-07-20T20:30:03Z")

</div>

Hi, I’ve been experimenting with Presets a bit in conjunction with `Ninja Multi-Config` generator.  
I encountered this issue,(simplified for the sake of this not being too long):

```json
{
  "version": 3,

"configurePresets": [
{
  "name": "multi",
  "generator": "Ninja Multi-Config"
},
{
  "name": "with-cuda"
  "inherits": "multi",
  "cacheVariables" : # enable cuda here etc.
},
... more combinations with multi as base config.
],
"buildPresets": [
  {
    "name": "release",
    "configurePreset": "multi",
    "configuration": "Release"
  },
  {
    "name": "debug",
    "configurePreset": "multi",
    "configuration": "Debug"
  }
  ... now we have to add release and debug for configurePreset with-cuda and every other preset inheriting from multi.

],
"testPresets": [
... same issue as with buildPresets
]
}

```

Now from documentation it seems like for each configure target I’d have to define 2 (or more) buildPresets (rel, debug, relwithdebinfo). This makes the `CMakePresets.json` quite repetitive. I do not know why the design decision to require `configurePreset` to be present in `buildPreset` was made so take what follows as thoughts of an user which might be incorrect/coming from misunderstanding the architecture.

What I feel like would be a good compromise is to make `configurePreset` in `buildPreset` mean this is the base I need, anything inheriting from the preset is also fine, or maybe a `configurePreset: "*"` to specify to just use currently active `configurePreset`.

When I posted this as an issue in the CMake repo, a workaround was suggested but that only works from commandline. For example VSCode integration won’t play nice with multi-config generators until this is somehow solved (or we’ll just have to accept the verbosity).

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [July 21, 2021, 1:37am UTC](https://discourse.cmake.org/t/presets-with-ninja-multi-config/3793/2 "2021-07-21T01:37:06Z")

</div>

Cc: @kyle.edwards

---

<div class="post-metadata">

### Author: ![rurabori](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rurabori/32/1651_2.png) [@rurabori](https://discourse.cmake.org/u/rurabori)
#### Post date: [July 24, 2021, 6:55am UTC](https://discourse.cmake.org/t/presets-with-ninja-multi-config/3793/3 "2021-07-24T06:55:04Z")

</div>

Any updates?

---

<div class="post-metadata">

### Author: ![rurabori](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rurabori/32/1651_2.png) [@rurabori](https://discourse.cmake.org/u/rurabori)
#### Post date: [August 5, 2021, 9:30pm UTC](https://discourse.cmake.org/t/presets-with-ninja-multi-config/3793/4 "2021-08-05T21:30:15Z")

</div>

Hi, I don’t want to spam/bother anyone here, but any updates on this?

---

<div class="post-metadata">

### Author: ![rurabori](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rurabori/32/1651_2.png) [@rurabori](https://discourse.cmake.org/u/rurabori)
#### Post date: [September 18, 2021, 6:15pm UTC](https://discourse.cmake.org/t/presets-with-ninja-multi-config/3793/5 "2021-09-18T18:15:24Z")

</div>

One last try, @brad.king suggested asking here instead of making an [issue](https://gitlab.kitware.com/cmake/cmake/-/issues/22439). Could anyone please help me understand this?

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [September 18, 2021, 10:17pm UTC](https://discourse.cmake.org/t/presets-with-ninja-multi-config/3793/6 "2021-09-18T22:17:03Z")

</div>

This seems like another scenario similar to those discussed in [issue 22538](https://gitlab.kitware.com/cmake/cmake/-/issues/22538). The combinatorial explosion of build presets is problematic as currently implemented, and the cases you mention are just another example of that. I suggest you follow issue 22538, as there’s at least some activity there and potentially some actions may come out of it.

---

<div class="post-metadata">

### Author: ![rurabori](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rurabori/32/1651_2.png) [@rurabori](https://discourse.cmake.org/u/rurabori)
#### Post date: [September 19, 2021, 2:45am UTC](https://discourse.cmake.org/t/presets-with-ninja-multi-config/3793/7 "2021-09-19T02:45:48Z")

</div>

Thank you so much, that was exactly what I was looking for!
