vcpkg env
Note
This command is only supported on Windows.
vcpkg env [<optional command>] [--triplet=<triplet>] [--options]
Creates a clean build environment in your current terminal. The created environment is a
cmd
session initialized to match the one vcpkg uses to build ports.
The session's configuration depends on your triplet settings. Use
the --triplet
option to specify the triplet to target, otherwise, a default triplet is
deduced. Depending on your settings
this may initialize a Visual Studio build environment via vcvars
.
Most environment variables are cleared from the session, with the exception of the environment
variables specified in the VCPKG_KEEP_ENV_VARS
environment variable and the VCPKG_ENV_PASSTROUGH
triplet setting.
Using the --bin
, --debug-bin
, --include
, --tools
, or --python
options prepends the
respective paths from the triplet's installed
folder to the session's environment variables.
Use these if you want to make tools and libraries installed by vcpkg available in the session.
See the build system manual integration documentation
to learn more about the installed
folder's hierarchy.
Optionally, you can specify a single command to execute. The session will terminate immediately afterwards.
PS C:\Users\vcpkg\vcpkg> vcpkg env
Microsoft Windows [Version 10.0.25905.1000]
(c) Microsoft Corporation. All rights reserved.
C:\Users\vcpkg\vcpkg>
PS C:\Users\vcpkg\vcpkg> vcpkg env "cmake --version"
cmake version 3.20.21032501-MSVC_2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
PS C:\Users\vcpkg\vcpkg> $env:CLEARED_ENV_VAR="hello"
PS C:\Users\vcpkg\vcpkg> vcpkg env "set CLEARED_ENV_VAR"
Environment variable CLEARED_ENV_VAR not defined
PS C:\Users\vcpkg\vcpkg> $env:VCPKG_KEEP_ENV_VARS="CLEARED_ENV_VAR"
PS C:\Users\vcpkg\vcpkg> vcpkg env "set CLEARED_ENV_VAR"
CLEARED_ENV_VAR=hello
PS C:\Users\vcpkg\vcpkg> vcpkg install minizip[tool]
PS C:\Users\vcpkg\vcpkg> vcpkg env --tools "minizip"
MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant
more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html
Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]
-o Overwrite existing file.zip
-a Append to existing file.zip
-0 Store only
-1 Compress faster
-9 Compress better
-j exclude path. store only the file name.
All vcpkg commands support a set of common options.
Specifies the triplet to target when configuring the environment. This affects how the Visual Studio
build environment is initialized and the installed
paths used by the other options.
See
--triplet
in the common options for more information.
Adds the triplet's installed bin
folder to the session's PATH
environment variable.
Adds the triplet's installed debug/bin
folder to the session's PATH
environment variable.
Adds the triplet's installed include
folder to the session's INCLUDE
environment variable.
Adds the triplet's installed tools
folder to the session's PATH
environment variable.
Adds the triplet's installed python
folder to the session's PYTHONPATH
environment variable.
vcpkg feedback
vcpkg is an open source project. Select a link to provide feedback: