-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
vcpkg env
doesn't preserve the VCPKG_VISUAL_STUDIO_PATH environment variable
#8009
Comments
Variables need to be prescribed in triplet All external will be ignored |
I'm not sure what you mean? I think I misunderstand you. Yes, it's true that the VCPKG_VISUAL_STUDIO_PATH environment variable will be overridden if the same is set in your triplet's cmake file. But you can set both. It is not that VCPKG_VISUAL_STUDIO_PATH is totally ignored as an env var. If VCPKG_VISUAL_STUDIO_PATH was only a triplet variable, there would be no point for this request since I would just write my own triplet file as that would be the only way to change compiler version. But it can be both in environment or in triplet.cmake, so I think the request at least makes sense. Or maybe you intend to suggest I should write my own triplet? |
vcpkg/triplet/x64-windows.cmake <<-- That's the triplet. Prescribe variables there Read the documentation if you're really interested in understanding |
I do understand that is where the triplet config file is, and that if you set the VCPKG_VISUAL_STUDIO_PATH there it overrides the env var of the same name. I don't see why it's relevant to my query which is about the env var. Given we can use both, I would like to have the env var work better.
I think I tried to explain this already but I was not clear.
… On Sep 12, 2019, at 10:32 PM, Voskrese ***@***.***> wrote:
vcpkg/triplet/x64-windows.cmake <<-- That's the triplet. Prescribe variables there
Read the documentation if you're really interested in understanding
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
The Visual Studio 2017 platform toolset is v141.
Line 126 in 300e21d
ENV SYSTEM, not USER ENV need more? |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
To see this problem in action:
set VCPKG_VISUAL_STUDIO_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise
(change "Enterprise" to whatever your VS edition is)
...\vcpkg.exe env
Currently, the new environment clears the
VCPKG_VISUAL_STUDIO_PATH
environment variable, which you can confirm by runningset VCPKG_VISUAL_STUDIO_PATH
. This means that if you then run...\vcpkg.exe install some-package-name
, VCpkg is not guaranteed to use the version of Visual Studio you specified.This is especially confusing since
vcpkg env
has set you up so that if you directly run the Microsoft Visual C++ compiler withcl.exe
, you will get MSVC v141 taken from the VS 2017 installation path. But if you runvcpkg install whatever
, the package could still be built with a different MSVC toolchain!Proposed solution:
In an ideal world, I'd like
vcpkg env
to preserve the value ofVCPKG_VISUAL_STUDIO_PATH
set invcpkg.exe
's original environment.Describe alternatives considered:
vcpkg env
then you won't have this problem. :)However, you'll lose the benefits of a cleaned-up PATH and so on.
vcpkg env
, you could remember toset VCPKG_VISUAL_STUDIO_PATH=[whatever]
again. But that's something you'd have to remember - and to figure out the first time!VCPKG_VISUAL_STUDIO_PATH
. That way, people like me who are surprised by the current behavior will be warned, while people who prefer or rely on the current behavior not changing will remain happy.Additional context:
I ran into this problem while trying to work around the fact that Microsoft C++ REST SDK does not currently build for the Universal Windows Platform (
[cpu]-uwp
triples) with Visual Studio 2019's MSVC v142. See #7540 ; microsoft/cpprestsdk#1227 . It was not fun to debug.The text was updated successfully, but these errors were encountered: