mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-07 23:28:36 -06:00
Help: De-duplicate VS instance selection documentation
Add a section to `CMAKE_GENERATOR_INSTANCE` for VS instance selection, and reference it from the corresponding sections of each VS generator.
This commit is contained in:
@@ -17,18 +17,8 @@ Instance Selection
|
||||
|
||||
.. versionadded:: 3.11
|
||||
|
||||
VS 2017 supports multiple installations on the same machine.
|
||||
The :variable:`CMAKE_GENERATOR_INSTANCE` variable may be set as a
|
||||
cache entry containing the absolute path to a Visual Studio instance.
|
||||
If the value is not specified explicitly by the user or a toolchain file,
|
||||
CMake queries the Visual Studio Installer to locate VS instances, chooses
|
||||
one, and sets the variable as a cache entry to hold the value persistently.
|
||||
|
||||
When CMake first chooses an instance, if the ``VS150COMNTOOLS`` environment
|
||||
variable is set and points to the ``Common7/Tools`` directory within
|
||||
one of the instances, that instance will be used. Otherwise, if more
|
||||
than one instance is installed we do not define which one is chosen
|
||||
by default.
|
||||
VS 2017 supports multiple installations on the same machine. The
|
||||
:variable:`CMAKE_GENERATOR_INSTANCE` variable may be used to select one.
|
||||
|
||||
Platform Selection
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -15,18 +15,8 @@ Powershell, Python, etc.) are not supported.
|
||||
Instance Selection
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
VS 2019 supports multiple installations on the same machine.
|
||||
The :variable:`CMAKE_GENERATOR_INSTANCE` variable may be set as a
|
||||
cache entry containing the absolute path to a Visual Studio instance.
|
||||
If the value is not specified explicitly by the user or a toolchain file,
|
||||
CMake queries the Visual Studio Installer to locate VS instances, chooses
|
||||
one, and sets the variable as a cache entry to hold the value persistently.
|
||||
|
||||
When CMake first chooses an instance, if the ``VS160COMNTOOLS`` environment
|
||||
variable is set and points to the ``Common7/Tools`` directory within
|
||||
one of the instances, that instance will be used. Otherwise, if more
|
||||
than one instance is installed we do not define which one is chosen
|
||||
by default.
|
||||
VS 2019 supports multiple installations on the same machine. The
|
||||
:variable:`CMAKE_GENERATOR_INSTANCE` variable may be used to select one.
|
||||
|
||||
Platform Selection
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -15,18 +15,8 @@ Powershell, Python, etc.) are not supported.
|
||||
Instance Selection
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
VS 2022 supports multiple installations on the same machine.
|
||||
The :variable:`CMAKE_GENERATOR_INSTANCE` variable may be set as a
|
||||
cache entry containing the absolute path to a Visual Studio instance.
|
||||
If the value is not specified explicitly by the user or a toolchain file,
|
||||
CMake queries the Visual Studio Installer to locate VS instances, chooses
|
||||
one, and sets the variable as a cache entry to hold the value persistently.
|
||||
|
||||
When CMake first chooses an instance, if the ``VS170COMNTOOLS`` environment
|
||||
variable is set and points to the ``Common7/Tools`` directory within
|
||||
one of the instances, that instance will be used. Otherwise, if more
|
||||
than one instance is installed we do not define which one is chosen
|
||||
by default.
|
||||
VS 2022 supports multiple installations on the same machine. The
|
||||
:variable:`CMAKE_GENERATOR_INSTANCE` variable may be used to select one.
|
||||
|
||||
Platform Selection
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -18,10 +18,21 @@ variable may initialize ``CMAKE_GENERATOR_INSTANCE`` as a cache entry.
|
||||
Once a given build tree has been initialized with a particular value
|
||||
for this variable, changing the value has undefined behavior.
|
||||
|
||||
Instance specification is supported only on specific generators:
|
||||
Instance specification is supported only on specific generators.
|
||||
|
||||
* For the :generator:`Visual Studio 15 2017` generator (and above)
|
||||
this specifies the absolute path to the VS installation directory
|
||||
of the selected VS instance.
|
||||
Visual Studio Instance Selection
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
See native build system documentation for allowed instance values.
|
||||
:ref:`Visual Studio Generators` support instance specification for
|
||||
Visual Studio 2017 and above. The ``CMAKE_GENERATOR_INSTANCE`` variable
|
||||
may be set as a cache entry selecting an instance of Visual Studio
|
||||
via the absolute path to the top-level directory of the VS installation.
|
||||
|
||||
If the value of ``CMAKE_GENERATOR_INSTANCE`` is not specified explicitly
|
||||
by the user or a toolchain file, CMake queries the Visual Studio Installer
|
||||
to locate VS instances, chooses one, and sets the variable as a cache entry
|
||||
to hold the value persistently. If an environment variable of the form
|
||||
``VS##0COMNTOOLS``, where ``##`` the Visual Studio major version number,
|
||||
is set and points to the ``Common7/Tools`` directory within one of the
|
||||
VS instances, that instance will be used. Otherwise, if more than one
|
||||
VS instance is installed we do not define which one is chosen by default.
|
||||
|
||||
Reference in New Issue
Block a user