CMAKE_GENERATOR_TOOLSET.rst 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. CMAKE_GENERATOR_TOOLSET
  2. -----------------------
  3. Native build system toolset specification provided by user.
  4. Some CMake generators support a toolset specification to tell the
  5. native build system how to choose a compiler. If the user specifies
  6. a toolset (e.g. via the :option:`cmake -T` option or via
  7. the :envvar:`CMAKE_GENERATOR_TOOLSET` environment variable) the value
  8. will be available in this variable.
  9. The value of this variable should never be modified by project code.
  10. A toolchain file specified by the :variable:`CMAKE_TOOLCHAIN_FILE`
  11. variable may initialize ``CMAKE_GENERATOR_TOOLSET``. Once a given
  12. build tree has been initialized with a particular value for this
  13. variable, changing the value has undefined behavior.
  14. Toolset specification is supported only on specific generators:
  15. * :ref:`Visual Studio Generators` for VS 2010 and above
  16. * The :generator:`Xcode` generator for Xcode 3.0 and above
  17. * The :generator:`Green Hills MULTI` generator
  18. See native build system documentation for allowed toolset names.
  19. Visual Studio Toolset Selection
  20. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  21. The :ref:`Visual Studio Generators` support toolset specification
  22. using one of these forms:
  23. * ``toolset``
  24. * ``toolset[,key=value]*``
  25. * ``key=value[,key=value]*``
  26. The ``toolset`` specifies the toolset name. The selected toolset name
  27. is provided in the :variable:`CMAKE_VS_PLATFORM_TOOLSET` variable.
  28. The ``key=value`` pairs form a comma-separated list of options to
  29. specify generator-specific details of the toolset selection.
  30. Supported pairs are:
  31. ``cuda=<version>|<path>``
  32. Specify the CUDA toolkit version to use or the path to a
  33. standalone CUDA toolkit directory. Supported by VS 2010
  34. and above. The version can only be used with the CUDA
  35. toolkit VS integration globally installed.
  36. See the :variable:`CMAKE_VS_PLATFORM_TOOLSET_CUDA` and
  37. :variable:`CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR` variables.
  38. ``host=<arch>``
  39. Specify the host tools architecture as ``x64`` or ``x86``.
  40. Supported by VS 2013 and above.
  41. See the :variable:`CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE`
  42. variable.
  43. ``version=<version>``
  44. Specify the toolset version to use. Supported by VS 2017
  45. and above with the specified toolset installed.
  46. See the :variable:`CMAKE_VS_PLATFORM_TOOLSET_VERSION` variable.
  47. ``VCTargetsPath=<path>``
  48. Specify an alternative ``VCTargetsPath`` value for Visual Studio
  49. project files. This allows use of VS platform extension configuration
  50. files (``.props`` and ``.targets``) that are not installed with VS.
  51. Visual Studio Toolset Customization
  52. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  53. **These are unstable interfaces with no compatibility guarantees**
  54. because they hook into undocumented internal CMake implementation details.
  55. Institutions may use these to internally maintain support for non-public
  56. Visual Studio platforms and toolsets, but must accept responsibility to
  57. make updates as changes are made to CMake.
  58. Additional ``key=value`` pairs are available:
  59. ``customFlagTableDir=<path>``
  60. .. versionadded:: 3.21
  61. Specify the absolute path to a directory from which to load custom
  62. flag tables stored as JSON documents with file names of the form
  63. ``<platform>_<toolset>_<tool>.json`` or ``<platform>_<tool>.json``,
  64. where ``<platform>`` is the :variable:`CMAKE_VS_PLATFORM_NAME`,
  65. ``<toolset>`` is the :variable:`CMAKE_VS_PLATFORM_TOOLSET`,
  66. and ``<tool>`` is the tool for which the flag table is meant.
  67. **This naming pattern is an internal CMake implementation detail.**
  68. The ``<tool>`` names are undocumented. The format of the ``.json``
  69. flag table files is undocumented.