Triplets
Triplet is a standard term used in cross-compiling as a way to completely capture the target environment (CPU, OS, compiler, runtime, etc.) in a single, convenient name.
In vcpkg, triplets describe an imaginary "target configuration set" for every
library. Within a triplet, libraries are generally built with the same
configuration, but it is not a requirement. For example, you could have one
triplet that builds openssl
statically and zlib
dynamically, one that
builds them both statically, and one that builds them both dynamically (all for
the same target OS and architecture).
A single build will consume files from up to two triplets: the target triplet and the host triplet. If you need to apply different settings for different libraries, you must make a single custom triplet with that combination of settings. See per-port customization for how to accomplish this.
vcpkg comes with pre-defined triplets for many common platforms and
configurations. Run vcpkg help triplet
to get a list of available triplets in your
environment.
To select a target triplet:
- In classic mode:
- Qualify package references with the triplet name, such as
zlib:x64-windows-static-md
. - Pass
--triplet=<triplet>
.
- Qualify package references with the triplet name, such as
- In CMake:
- Set
VCPKG_TARGET_TRIPLET
.
- Set
- In MSBuild:
- Set
VcpkgTriplet
.
- Set
To select the host triplet for the current machine:
- In classic mode:
- Pass
--host-triplet=<triplet>
.
- Pass
- In CMake:
- Set
VCPKG_HOST_TRIPLET
.
- Set
- In MSBuild:
- Set
VcpkgHostTriplet
.
- Set
Triplets contained in the triplets\community
folder are not tested by the
curated registry's continuous integration, but are commonly requested by the
community. Because we do not have continuous coverage, port updates may break
compatibility with community triplets. We gladly accept and review contributions
that aim to solve issues with these triplets.
When using a community triplet, a message like the following will be printed during a package installation:
-- Using community triplet x86-uwp. This triplet configuration is not guaranteed to succeed.
-- [COMMUNITY] Loading triplet configuration from: D:\src\vcpkg\triplets\community\x86-uwp.cmake
You can extend vcpkg by replacing in-the-box triplets or creating new triplets for your particular project.
First, copy a built-in triplet file from the triplets\
directory into a
different filesystem location. Then, add that directory to the list of overlay
triplet paths when interacting with vcpkg.
- In Manifest mode, you can use
$.vcpkg-configuration.overlay-triplets
. - When using vcpkg from CMake, you can set
VCPKG_OVERLAY_TRIPLETS
. - When using vcpkg from MSBuild, you can add
--overlay-triplets=...
to MSBuild Additional Options. - When using the CLI directly, you can pass
--overlay-triplets=...
. - You can set the
$VCPKG_OVERLAY_TRIPLETS
environment variable to a list of overlay paths.
See our overlay triplets example for a more detailed walkthrough.
Note
Triplet names may only contain lowercase alphanumberical characters and hyphens.
The default triplet when running any vcpkg command is %VCPKG_DEFAULT_TRIPLET%
or a platform-specific choice if that environment variable is undefined.
- Windows:
x64-windows
- Linux:
x64-linux
- OSX:
x64-osx
We recommend using a systematic naming scheme when creating new triplets. The Android toolchain naming scheme is a good source of inspiration: https://developer.android.com/ndk/guides/standalone_toolchain.html.
vcpkg feedback
vcpkg is an open source project. Select a link to provide feedback: