Closed hjmallon closed 4 years ago
There's only once Visual Studio Build Tools instance installed. Installing different versions of the compiler/toolset are features in that instance. If you want to see features installed, expand the Packages
property. You can filter on type (e.g. 'Component') and partial name, like 'MSVC' using cmdlets like where-object
.
I think I may have misunderstood. Is it possible to use this project to set up the environment like vcvarsall.bat
used to do? I am trying to use 2019 tools (with 2015 and 2017 compilers installed) and make powershell instances where I can use cmake with each version.
Using CMD and 2017 tools (with 2015 compiler installed) I was able to choose which tools to use with vcvarsall.bat
.
For anyone looking at this in the future. The answer is to use CMAKE_GENERATOR_TOOLSET
.
https://cmake.org/cmake/help/latest/variable/CMAKE_GENERATOR_TOOLSET.html#variable:CMAKE_GENERATOR_TOOLSET
cmake -Ax64 -G"Visual Studio 16 2019" -Tv141 ../
Using the Developer Command Prompt is what we recommend for setting up an environment. CMake also uses the VS setup query API to set variables for use in CMake (as do some other build toolsets), but please see their documentation for details. As for creating your own environment, you're welcome to look through vcvarsall.bat and related scripts, but note this is unsupported.
Visual Studio 2019 installer allows you to install different versions of the compiler. e.g.
I have all three of these installed but:
How do I therefore set up a powershell session so that I can use the 2017 tools?