Preset: setting build directory based on compiler

I’m working on a library that I will compile with lots of different compilers, build modes, etc.

I can add, as a preset:

"binaryDir": "build/debug",

or even

"binaryDir": "build/${presetName}",

But I don’t see a macro to get the C++ compiler name or version. Ideally I’d want something like build/${compiler}/${presetName} to be able to give me a string like build/gcc-13.2.0/debug. Is there a way to do that?

That wouldn’t be possible within the constraints for preset files. Things other than CMake need to be able to read and fully process them without running CMake. The compiler details are only available after CMake has read the toolchain file and enabled that language. Things like IDEs and other tools don’t have access to those details, they are not running CMake and can’t be expected to. Presets need to be evaluated purely with the information they contain and can’t rely on details only available once CMake starts running.