b17d83acf3d9a6e8f1e6e764fb6aab3cd01a4b9a
[platform/upstream/cmake.git] / Help / variable / CMAKE_GENERATOR_PLATFORM.rst
1 CMAKE_GENERATOR_PLATFORM
2 ------------------------
3
4 .. versionadded:: 3.1
5
6 Generator-specific target platform specification provided by user.
7
8 Some CMake generators support a target platform name to be given
9 to the native build system to choose a compiler toolchain.
10 If the user specifies a platform name (e.g. via the :manual:`cmake(1)` ``-A``
11 option or via the :envvar:`CMAKE_GENERATOR_PLATFORM` environment variable)
12 the value will be available in this variable.
13
14 The value of this variable should never be modified by project code.
15 A toolchain file specified by the :variable:`CMAKE_TOOLCHAIN_FILE`
16 variable may initialize ``CMAKE_GENERATOR_PLATFORM``.  Once a given
17 build tree has been initialized with a particular value for this
18 variable, changing the value has undefined behavior.
19
20 Platform specification is supported only on specific generators:
21
22 * For :ref:`Visual Studio Generators` with VS 2005 and above this
23   specifies the target architecture.
24
25 * For :generator:`Green Hills MULTI` this specifies the target architecture.
26
27 See native build system documentation for allowed platform names.
28
29 Visual Studio Platform Selection
30 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
31
32 On :ref:`Visual Studio Generators` the selected platform name
33 is provided in the :variable:`CMAKE_VS_PLATFORM_NAME` variable.