Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using VS2015 when VS2017 is available #766

Closed
chrullrich opened this issue Mar 11, 2017 · 7 comments
Closed

Using VS2015 when VS2017 is available #766

chrullrich opened this issue Mar 11, 2017 · 7 comments
Assignees
Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed

Comments

@chrullrich
Copy link
Contributor

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.

@ras0219-msft
Copy link
Contributor

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).

@ras0219-msft ras0219-msft added the category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed label Mar 12, 2017
@jacobblock
Copy link

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!

@ras0219-msft
Copy link
Contributor

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?

@jacobblock
Copy link

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.

@traversaro
Copy link
Contributor

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.

@tnie
Copy link

tnie commented Feb 19, 2019

@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.

image

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.

@PhoebeHui
Copy link
Contributor

You can also set VCPKG_VISUAL_STUDIO_PATH in triplet.

@microsoft microsoft locked and limited conversation to collaborators Jul 22, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed
Projects
None yet
Development

No branches or pull requests

7 participants