I have Mingw64 GCC 6.3.0 (always in PATH) and Visual C++ compiler tools from Visual Studio 2017 RTM (not in PATH).
PATH
If I run cmake . -
cmake . -
use a toolchain file
set(CMAKE_C_COMPILER cl.exe) set(CMAKE_CXX_COMPILER cl.exe)
then build your cmake project with with -DCMAKE_TOOLCHAIN_FILE=toolchainfile