# VS generator and toolchain files

**URL:** https://discourse.cmake.org/t/vs-generator-and-toolchain-files/1177
**Category:** Code
**Tags:** gen:vs
**Created:** [May 9, 2020, 12:33pm UTC](https://discourse.cmake.org/t/vs-generator-and-toolchain-files/1177 "2020-05-09T12:33:12Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [May 11, 2020, 5:54pm UTC](https://discourse.cmake.org/t/vs-generator-and-toolchain-files/1177/3 "2020-05-11T17:54:54Z")

</div>

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](https://cmake.org/cmake/help/v3.17/variable/CMAKE_GENERATOR_TOOLSET.html#visual-studio-toolset-selection) setting (`cmake -T ...` option). That is something the toolchain file could set, but it will only work if the toolset has proper MSBuild integration.

---

_[View the full topic](https://discourse.cmake.org/t/vs-generator-and-toolchain-files/1177)._
