From bf82472275773520592cf3089034ba48699893cd Mon Sep 17 00:00:00 2001 From: RussellBentley Date: Tue, 17 Aug 2021 12:56:10 -0400 Subject: [PATCH 1/2] Add comments for VCPKG_TARGET_TRIPLET to docs --- README.md | 8 ++++++++ docs/examples/installing-and-using-packages.md | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 936cc16819873f..50b89d3471e479 100644 --- a/README.md +++ b/README.md @@ -288,6 +288,14 @@ This will still allow people to not use vcpkg, by passing the `CMAKE_TOOLCHAIN_FILE` directly, but it will make the configure-build step slightly easier. +### Specifying Target Triplet + +When using a triplet that isn't the default, like `x64-windows-static`, cmake needs to be made aware of the target triplet. This can be done with `VCPKG_TARGET_TRIPLET`. + +``` +-DVCPKG_TARGET_TRIPLET=[triplet] +``` + [getting-started:using-a-package]: docs/examples/installing-and-using-packages.md [getting-started:integration]: docs/users/integration.md [getting-started:git]: https://git-scm.com/downloads diff --git a/docs/examples/installing-and-using-packages.md b/docs/examples/installing-and-using-packages.md index 011df93a4cc9f9..11060cc9e9b59f 100644 --- a/docs/examples/installing-and-using-packages.md +++ b/docs/examples/installing-and-using-packages.md @@ -92,6 +92,12 @@ To remove the integration for your user, you can use `.\vcpkg integrate remove`. The best way to use installed libraries with cmake is via the toolchain file `scripts\buildsystems\vcpkg.cmake`. To use this file, you simply need to add it onto your CMake command line as: `-DCMAKE_TOOLCHAIN_FILE=D:\src\vcpkg\scripts\buildsystems\vcpkg.cmake`. +When using a triplet that isn't the default, like `x64-windows-static`, cmake needs to be made aware of the target triplet. This can be done with `VCPKG_TARGET_TRIPLET`. + +``` +-DVCPKG_TARGET_TRIPLET=[triplet] +``` + If you are using CMake through Open Folder with Visual Studio you can define `CMAKE_TOOLCHAIN_FILE` by adding a "variables" section to each of your `CMakeSettings.json` configurations: ```json From e3726ccc0aa095f857a605a318f1adb776865fec Mon Sep 17 00:00:00 2001 From: RussellBentley Date: Mon, 23 Aug 2021 11:51:33 -0400 Subject: [PATCH 2/2] Update docs to include VCPKG_HOST_TRIPLET --- README.md | 16 +++++++++++++--- docs/examples/installing-and-using-packages.md | 10 +++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 50b89d3471e479..d268dcdde19bb0 100644 --- a/README.md +++ b/README.md @@ -288,14 +288,24 @@ This will still allow people to not use vcpkg, by passing the `CMAKE_TOOLCHAIN_FILE` directly, but it will make the configure-build step slightly easier. -### Specifying Target Triplet +### Specifying Triplets -When using a triplet that isn't the default, like `x64-windows-static`, cmake needs to be made aware of the target triplet. This can be done with `VCPKG_TARGET_TRIPLET`. +Vcpkg uses triplets to capture the desired target platform, and link type, as well as the host platform and link type. +If the default triplets are not used, then they must be specified both when building packages and when using them. +See the documenation on [integrating](docs/users/integration.md) and [host dependencies](docs/users/host-dependencies.md) for more information. +When installing packages, the triplets can be specified with command line flags. +`--triplet [triplet]` for target packages and `--host-triplet [triplet]` for host dependencies. + +For projects cmake projects using the vcpkg toolchain, the triplets can be specified using the `VCPKG_TARGET_TRIPLET` and `VCPKG_HOST_TRIPLET` respectivley. +For example ``` --DVCPKG_TARGET_TRIPLET=[triplet] +-DVCPKG_TARGET_TRIPLET=[target-triplet] +-DVCPKG_HOST_TRIPLET=[host-triplet] ``` +For both installation and use, `VCPKG_TARGET_TRIPLET` and `VCPKG_HOST_TRIPLET` environment variables can also be used. + [getting-started:using-a-package]: docs/examples/installing-and-using-packages.md [getting-started:integration]: docs/users/integration.md [getting-started:git]: https://git-scm.com/downloads diff --git a/docs/examples/installing-and-using-packages.md b/docs/examples/installing-and-using-packages.md index 11060cc9e9b59f..ddf64c62d09a22 100644 --- a/docs/examples/installing-and-using-packages.md +++ b/docs/examples/installing-and-using-packages.md @@ -92,12 +92,16 @@ To remove the integration for your user, you can use `.\vcpkg integrate remove`. The best way to use installed libraries with cmake is via the toolchain file `scripts\buildsystems\vcpkg.cmake`. To use this file, you simply need to add it onto your CMake command line as: `-DCMAKE_TOOLCHAIN_FILE=D:\src\vcpkg\scripts\buildsystems\vcpkg.cmake`. -When using a triplet that isn't the default, like `x64-windows-static`, cmake needs to be made aware of the target triplet. This can be done with `VCPKG_TARGET_TRIPLET`. - +When using non-default triplets, they need to specified for cmake. +They can be specified using the `VCPKG_TARGET_TRIPLET` and `VCPKG_HOST_TRIPLET` respectivley. +For example ``` --DVCPKG_TARGET_TRIPLET=[triplet] +-DVCPKG_TARGET_TRIPLET=[target-triplet] +-DVCPKG_HOST_TRIPLET=[host-triplet] ``` +Alternativley, `VCPKG_TARGET_TRIPLET` and `VCPKG_HOST_TRIPLET` environment variables can also be used. + If you are using CMake through Open Folder with Visual Studio you can define `CMAKE_TOOLCHAIN_FILE` by adding a "variables" section to each of your `CMakeSettings.json` configurations: ```json