VS generator and toolchain files

I was trying to use the Emscripten.cmake toolchain file with the Visual Studio generator, but it seems it still tries to use CL.exe and LINK.exe.

Is this a limitation of the generator? It works fine with make and ninja.

(I used the gui to configure)

This might be a limitation? Though VS supports cross-compilation in other ways, so maybe it just has some other mechanism for choosing the Emscripten toolchain. Maybe cmake -T offers this?

Cc: @brad.king

The VS generator produces .vcxproj files and uses MSBuild to actually drive the build. The values of CMAKE_{C,CXX}_COMPILER are computed automatically from the compiler MSBuild chooses so setting them has no effect. With this generator we can only support toolchains that have integration with MSBuild installed such that one could manually create a project using them through the IDE. Both the Intel C/C++/Fortran compilers and NVIDIA CUDA compilers are examples of this.

For Visual Studio generators the compiler is selected by the CMAKE_GENERATOR_TOOLSET setting (cmake -T ... option). That is something the toolchain file could set, but it will only work if the toolset has proper MSBuild integration.