1Visual Studio 15 2017
2---------------------
3
4.. versionadded:: 3.7.1
5
6Generates Visual Studio 15 (VS 2017) project files.
7
8Project Types
9^^^^^^^^^^^^^
10
11Only Visual C++ and C# projects may be generated (and Fortran with
12Intel compiler integration).  Other types of projects (JavaScript,
13Powershell, Python, etc.) are not supported.
14
15Instance Selection
16^^^^^^^^^^^^^^^^^^
17
18.. versionadded:: 3.11
19
20VS 2017 supports multiple installations on the same machine.
21The :variable:`CMAKE_GENERATOR_INSTANCE` variable may be set as a
22cache entry containing the absolute path to a Visual Studio instance.
23If the value is not specified explicitly by the user or a toolchain file,
24CMake queries the Visual Studio Installer to locate VS instances, chooses
25one, and sets the variable as a cache entry to hold the value persistently.
26
27When CMake first chooses an instance, if the ``VS150COMNTOOLS`` environment
28variable is set and points to the ``Common7/Tools`` directory within
29one of the instances, that instance will be used.  Otherwise, if more
30than one instance is installed we do not define which one is chosen
31by default.
32
33Platform Selection
34^^^^^^^^^^^^^^^^^^
35
36The default target platform name (architecture) is ``Win32``.
37
38The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps
39via the :manual:`cmake(1)` ``-A`` option, to specify a target platform
40name (architecture).  For example:
41
42* ``cmake -G "Visual Studio 15 2017" -A Win32``
43* ``cmake -G "Visual Studio 15 2017" -A x64``
44* ``cmake -G "Visual Studio 15 2017" -A ARM``
45* ``cmake -G "Visual Studio 15 2017" -A ARM64``
46
47For compatibility with CMake versions prior to 3.1, one may specify
48a target platform name optionally at the end of the generator name.
49This is supported only for:
50
51``Visual Studio 15 2017 Win64``
52  Specify target platform ``x64``.
53
54``Visual Studio 15 2017 ARM``
55  Specify target platform ``ARM``.
56
57Toolset Selection
58^^^^^^^^^^^^^^^^^
59
60The ``v141`` toolset that comes with Visual Studio 15 2017 is selected by
61default.  The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps
62via the :manual:`cmake(1)` ``-T`` option, to specify another toolset.
63
64.. |VS_TOOLSET_HOST_ARCH_DEFAULT| replace::
65   By default this generator uses the 32-bit variant even on a 64-bit host.
66
67.. include:: VS_TOOLSET_HOST_ARCH_LEGACY.txt
68