Visual Studio 17 2022.rst 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. Visual Studio 17 2022
  2. ---------------------
  3. .. versionadded:: 3.21
  4. Generates Visual Studio 17 (VS 2022) project files.
  5. .. warning::
  6. This is experimental and based on "Visual Studio 2022 Preview 1.1".
  7. As of this version of CMake, VS 2022 has not been released.
  8. Project Types
  9. ^^^^^^^^^^^^^
  10. Only Visual C++ and C# projects may be generated. Other types of
  11. projects (JavaScript, Powershell, Python, etc.) are not supported.
  12. Instance Selection
  13. ^^^^^^^^^^^^^^^^^^
  14. VS 2022 supports multiple installations on the same machine.
  15. The :variable:`CMAKE_GENERATOR_INSTANCE` variable may be set as a
  16. cache entry containing the absolute path to a Visual Studio instance.
  17. If the value is not specified explicitly by the user or a toolchain file,
  18. CMake queries the Visual Studio Installer to locate VS instances, chooses
  19. one, and sets the variable as a cache entry to hold the value persistently.
  20. When CMake first chooses an instance, if the ``VS170COMNTOOLS`` environment
  21. variable is set and points to the ``Common7/Tools`` directory within
  22. one of the instances, that instance will be used. Otherwise, if more
  23. than one instance is installed we do not define which one is chosen
  24. by default.
  25. Platform Selection
  26. ^^^^^^^^^^^^^^^^^^
  27. The default target platform name (architecture) is that of the host
  28. and is provided in the :variable:`CMAKE_VS_PLATFORM_NAME_DEFAULT` variable.
  29. The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps
  30. via the :manual:`cmake(1)` ``-A`` option, to specify a target platform
  31. name (architecture). For example:
  32. * ``cmake -G "Visual Studio 17 2022" -A Win32``
  33. * ``cmake -G "Visual Studio 17 2022" -A x64``
  34. * ``cmake -G "Visual Studio 17 2022" -A ARM``
  35. * ``cmake -G "Visual Studio 17 2022" -A ARM64``
  36. Toolset Selection
  37. ^^^^^^^^^^^^^^^^^
  38. The ``v142`` toolset that comes with VS 17 2022 Preview 1.1 is selected by
  39. default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps
  40. via the :manual:`cmake(1)` ``-T`` option, to specify another toolset.
  41. .. |VS_TOOLSET_HOST_ARCH_DEFAULT| replace::
  42. By default this generator uses the 64-bit variant on x64 hosts and
  43. the 32-bit variant otherwise.
  44. .. include:: VS_TOOLSET_HOST_ARCH.txt