Presets with Ninja Multi-Config

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):

{
  "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).

Cc: @kyle.edwards

Any updates?

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

One last try, @brad.king suggested asking here instead of making an issue. Could anyone please help me understand this?

This seems like another scenario similar to those discussed in issue 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.

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