vcpkg env
doesn't preserve the VCPKG_VISUAL_STUDIO_PATH environment variable
#19247
Replies: 5 comments
-
Variables need to be prescribed in triplet All external will be ignored |
Beta Was this translation helpful? Give feedback.
-
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? |
Beta Was this translation helpful? Give feedback.
-
vcpkg/triplet/x64-windows.cmake <<-- That's the triplet. Prescribe variables there Read the documentation if you're really interested in understanding |
Beta Was this translation helpful? Give feedback.
-
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.
|
Beta Was this translation helpful? Give feedback.
-
https://github.com/microsoft/vcpkg/blob/master/docs/users/triplets.md#vcpkg_visual_studio_path
The Visual Studio 2017 platform toolset is v141.
Line 126 in 300e21d ENV SYSTEM, not USER ENV need more? |
Beta Was this translation helpful? Give feedback.
-
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.Beta Was this translation helpful? Give feedback.
All reactions