IjonTichy
IjonTichy

Reputation: 333

How to install multiple versions of MSBuild and use them with cmake

I installed the MSBuild Tools with the current 2022 Installer, as seen in the image i also install MSVC 140, 141 and 142 as well as the c++ cmake-tools for windows.

Visual Studio Installer

Now, if i want to run cmake with a Generator other than "Visual Studio 17 2022" cmake is giving me the following error:

CMake Error

So, my question is, how do i install multiple versions of MSBuild which are actually usable by cmake?

Thanks!

Upvotes: 0

Views: 936

Answers (1)

fdan
fdan

Reputation: 1804

You only have 2022 installed, so you can't use any other generator. You installed toolkits using Visual Studio 2022. You can define the toolkit using the command line, e.g.:

cmake .. -G "Visual Studio 17 2022" -T v142

See https://cmake.org/cmake/help/latest/manual/cmake.1.html.

Upvotes: 2

Related Questions