I have both VS2015 and VS2017 installed and would like to have one vcpkg environment for each toolset. Is there a way to get vcpkg to use the older one? I have tried running it in a VS2015 developer command prompt; it still uses the newer compilers.
We don't currently have an easy, supported way to opt out of VS2017. We'd like to do better in the future, but for now the closest options are:
1. Set the VCPKG_PLATFORM_TOOLSET variable in a triplet. You can make a new triplet for this purpose by copying one of the existing ones (inside triplets\) and adding the line:
set(VCPKG_PLATFORM_TOOLSET "v140")
This will work for CMake-based ports that don't use Ninja and possibly others. Notably, this will _not_ change boost.
2. In your "VS2015" vcpkg enlistment, modify scripts\findVisualStudioInstallationInstances.ps1 to immediately return an empty string. This will "properly" hijack _all_ uses of VS2017, including the initial bootstrap of vcpkg.exe itself.
In the future, we would like to make option 1 above the official, supported way (and make it work for all portfiles).
Hi, is this still the case? I don't see any flexibility in picking a toolset during the bootstrap process. v140 is only searched if v141 isn't found in scripts\findVisualStudioInstallationInstances.ps1.
Thanks!
We don't currently have a way to opt-out from using v141 during the _bootstrap_ process, since it doesn't affect any of the produced libraries and we want the tool to be as fast as possible with the latest toolset 馃槃.
Could you detail a bit more about the issues you're having with using VS2017 while boostrapping vcpkg.exe?
Ah well then perhaps I have some other issue. I was basically setting VCPKG_PLATFORM_TOOLSET to v140 in my triplet file and getting an immediate build error with zlib. The build was still trying to be performed with VS2017 (and works if I don't specify the VCPKG_PLATFORM_TOOLSET). Forcing the bootstrap to find VS2015 instead of VS2017 fixed the error; perhaps I needed to do some more investigation if the bootstrap shouldn't impact the build process.
Small note: given that backward compatibility of libraries generated with v141 with executable compiled with v140 is not guaranteed (see https://docs.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017?view=vs-2017) this feature may be important to anyone that wants to build and distribute libraries that could be consumable by both VS2015 and VS2017.
@jacobblock
Ah well then perhaps I have some other issue. I was basically setting VCPKG_PLATFORM_TOOLSET to v140 in my triplet file and getting an immediate build error with zlib. The build was still trying to be performed with VS2017 (and works if I don't specify the VCPKG_PLATFORM_TOOLSET).
vcpkg install zlib:xxx using ninja.

About setting VCPKG_PLATFORM_TOOLSET
This will work for CMake-based ports that don't use Ninja and possibly others. Notably, this will _not_ change
boost.