If Visual Studio 2022 is installed, including the older Toolset V142, and NO VS2019 is installed, can the ‘Visual Studio 16 2019 Generator’ be used, to create a solution targeting the old toolset?
Our large application is currently stuck on CMake 3.15.x, however our team is migrating to Visual Studio 2022. Until now we’ve kept the buildscripts locked to VS Toolset 142 and haven’t had a problem. Now we have our first developer whose installed VS2022 with no Visual Studio 2019 present and gets an error:
CMake Error at CMakeLists.txt:89 (project): Generator Visual Studio 16 2019 could not find any instance of Visual Studio.
Before firing CMake, our build scripts run these two tools:
%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe %FoundVsInstallDir%\VC\Auxiliary\Build\vcvarsall.bat
After tweaking the build-scripts, I realized even on my machine ‘vswhere.exe’ is now detecting a VS 2022 Enterprise on D:\ first, but CMake is using VS2019 in the default location. I can’t see how CMake is selecting that.
If we can’t upgrade CMake at this time, is having VS2019 installed simply for the GENERATOR a forced requirement?