I have a project that I’d like to use different generators for depending on the OS that is compiling it (specifically, Unix Makefiles for Linux and Visual Studio/Ninja for Windows).
I’d like to just let the automatic generator discovery happen when using cmake presets configurePresets, such as when I run
cmake . without any arguments. On Windows it automatically discovers msvc and uses the Visual Studio generator, while on Linux it uses gnu and Unix Makefiles. The docs seem to suggest this should happen.
However, when I omit the
generator field on all of my configurePresets, it seems to always try to use Unix Makefiles, even on Windows. This occurs when I try to run using
cmake . --preset X and when trying to use the VSCode CMake extension to configure.
I’ve tested this on CMake v3.22 on Linux and 3.25 on Windows with the same result, both CMakePresets.json v3.
Is my expectation incorrect here?