From 36cb7592b18d261f87ef366f9271ca45eadffb88 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Wed, 30 Jan 2019 17:47:36 -0800 Subject: [vcpkg-docs] Improve documentation for Visual Studio 2019 --- docs/users/triplets.md | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'docs/users') diff --git a/docs/users/triplets.md b/docs/users/triplets.md index 4f23c8e27..87fa72fd3 100644 --- a/docs/users/triplets.md +++ b/docs/users/triplets.md @@ -53,25 +53,33 @@ This option also has forms for configuration-specific and C flags: ## Windows Variables -### VCPKG_PLATFORM_TOOLSET -Specifies the VS-based C/C++ compiler toolchain to use. - -This can be set to `v141`, `v140`, or left blank. If left blank, we select the latest compiler toolset available on your machine. - -Visual Studio 2015 platform toolset is `v140` -Visual Studio 2017 platform toolset is `v141` - ### VCPKG_VISUAL_STUDIO_PATH Specifies the Visual Studio installation to use. -When unspecified, a Visual Studio instance is selected automatically, preferring Stable 2017, then Preview 2017, then 2015. +To select the precise combination of Visual Studio instance and toolset version, we walk through the following algorithm: +1. Determine the setting for `VCPKG_VISUAL_STUDIO_PATH` from the triplet, or the environment variable `VCPKG_VISUAL_STUDIO_PATH`, or consider it unset +2. Determine the setting for `VCPKG_PLATFORM_TOOLSET` from the triplet or consider it unset +3. Gather a list of all pairs of Visual Studio Instances with all toolsets available in those instances + 1. This is ordered first by instance type (Stable, Prerelease, Legacy) and then by toolset version (v142, v141, v140) +4. Filter the list based on the settings for `VCPKG_VISUAL_STUDIO_PATH` and `VCPKG_PLATFORM_TOOLSET`. +5. Select the best remaining option The path should be absolute, formatted with backslashes, and have no trailing slash: ```cmake set(VCPKG_VISUAL_STUDIO_PATH "C:\\Program Files (x86)\\Microsoft Visual Studio\\Preview\\Community") ``` +### VCPKG_PLATFORM_TOOLSET +Specifies the VS-based C/C++ compiler toolchain to use. + +See [`VCPKG_VISUAL_STUDIO_PATH`](#VCPKG_VISUAL_STUDIO_PATH) for the full selection algorithm. + +Valid settings: +* The Visual Studio 2019 platform toolset is `v142`. +* The Visual Studio 2017 platform toolset is `v141`. +* The Visual Studio 2015 platform toolset is `v140`. + ## MacOS Variables ### VCPKG_INSTALL_NAME_DIR -- cgit v1.2.3 From 4ad78224c989953cde21c77dd63345b9f722671b Mon Sep 17 00:00:00 2001 From: zhihaoy <43971430+zhihaoy@users.noreply.github.com> Date: Fri, 22 Feb 2019 18:29:05 -0600 Subject: [docs] Show how to default VCPKG_TARGET_TRIPLET (#5346) --- docs/users/integration.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'docs/users') diff --git a/docs/users/integration.md b/docs/users/integration.md index 10f5574c1..6d56c7c70 100644 --- a/docs/users/integration.md +++ b/docs/users/integration.md @@ -135,9 +135,16 @@ To override the automatically chosen [triplet][], you can specify the MSBuild pr ``` #### With CMake -Simply set `VCPKG_TARGET_TRIPLET` on the configure line. +You can set `VCPKG_TARGET_TRIPLET` on the configure line: ```no-highlight cmake ../my/project -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=... ``` +If you use `VCPKG_DEFAULT_TRIPLET` [environment variable](config-environment.md) to contoll the unqualified triplet in vcpkg command lines you can default `VCPKG_TARGET_TRIPLET` in CMake like [Using an environment variable instead of a command line option](#using-an-environment-variable-instead-of-a-command-line-option): + +```cmake +if(DEFINED ENV{VCPKG_DEFAULT_TRIPLET} AND NOT DEFINED VCPKG_TARGET_TRIPLET) + set(VCPKG_TARGET_TRIPLET "$ENV{VCPKG_DEFAULT_TRIPLET}" CACHE STRING "") +endif() +``` [triplet]: triplets.md -- cgit v1.2.3 From 9ef92a21a07a3f6685df08a6f8cfed2b0cb5ea9c Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Mon, 25 Feb 2019 13:25:27 -0800 Subject: [vcpkg-docs] Replace reference to VCPKG_DEFAULT_VS_PATH with VCPKG_VISUAL_STUDIO_PATH --- docs/users/config-environment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/users') diff --git a/docs/users/config-environment.md b/docs/users/config-environment.md index 103c1c547..f25df89a3 100644 --- a/docs/users/config-environment.md +++ b/docs/users/config-environment.md @@ -26,7 +26,7 @@ This environment variable can be set to the full path of an executable to be use This environment variable can be set to a directory to use as the root of the vcpkg instance. Note that mixing vcpkg repo versions and executable versions can cause issues. -#### VCPKG_DEFAULT_VS_PATH +#### VCPKG_VISUAL_STUDIO_PATH This environment variable can be set to the full path to a Visual Studio instance on the machine. This Visual Studio instance will be used if the triplet does not override it via the [`VCPKG_VISUAL_STUDIO_PATH` triplet setting](triplets.md#VCPKG_VISUAL_STUDIO_PATH). -- cgit v1.2.3