Is there a way to check available CMake generators? Some argument to query it from CMake? I cannot find a way to do this. I mean generators that are actually available and will successfully configure projects. For example I’d like to get
Visual Studio 15 2017 only if VS2017 is installed.
I tried to workaround by just calling
cmake -G <generator_name> and parsing output to find “CMake Error: Could not create named generator” message. This works fine on Linux. I don’t even have to create CMakeLists.txt, the response is pretty fast. The problem with this approach is on Windows. For some reason I have to create CMakeLists.txt, otherwise it won’t check the availability of generator. And generating project files take a really long time - about 3 seconds. Too long for checking that many generators.
cmake -E capabilities, but it doesn’t provide information of what’s actually available on current system. Only general metadata.