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.