Visual Studio 17 2022.rst 2.2 KB

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