Inspecting the host system for what generators will work
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 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.