Generator property in presets

I figured this would be better as a discource than an issue.

Why is the generator property in the presets mandatory? This reduces the usability of presets and makes it difficult replace shell or other scripts to configure a project that does not care about which generator is in use, but still wants to have a set of common cache variables in.

Let’s assume that I have 10 CI workflows with 10 different build systems across 3 OS platforms. Now I either copy paste the preset that contains a bunch of cache variables for each CI workflow and make it more difficult if those variables need to be modified, or do the same but with inherits and still get a lot of repetition, or create scripts to invoke CMake with just to pass those cache variables with automatic generator recognition.

If presets allowed leaving the generator property out and instead CMake looked for a default one like it normally does, then a single preset could support any platform and those commonly used cache variables could be nicely bundled up in a preset.

1 Like


This is left over from when we were originally trying to replicate CMakeSettings.json from Visual Studio, which required the build directory and generator. We could probably make it optional for version 3.