I have Mingw64 GCC 6.3.0 (always in PATH) and Visual C++ compiler tools from Visual Studio 2017 RTM (not in PATH).
If I run cmake . -G "MinGW Makefiles", GCC 6.3.0 will be selected.
If I run cmake . -G "Ninja", GCC 6.3.0 will be selected.
My Visual C++ compiler tools is none standard, I only keep the parts I need and delete the rest (like MSBuild, IDE etc.). I use my own batch script to set up PATH, INCLUDE and LIB (works just fine).
If I run this batch script and run cmake ., MSVC will be selected and build with NMake.
With the same environment, cmake . -G "Ninja", GCC 6.3.0 is selected instead of MSVC.
So my question is, how to tell CMake I want to use MSVC + Ninja rather than GCC + Ninja when both are in PATH? Any environment variable I should set?