Imported Upstream version 3.25.0
[platform/upstream/cmake.git] / Help / generator / Xcode.rst
1 Xcode
2 -----
3
4 Generate Xcode project files.
5
6 .. versionchanged:: 3.15
7   This generator supports Xcode 5.0 and above.
8
9 .. _`Xcode Build System Selection`:
10
11 Toolset and Build System Selection
12 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13
14 By default Xcode is allowed to select its own default toolchain.
15 The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps
16 via the :option:`cmake -T` option, to specify another toolset.
17
18 .. versionadded:: 3.19
19   This generator supports toolset specification using one of these forms:
20
21 * ``toolset``
22 * ``toolset[,key=value]*``
23 * ``key=value[,key=value]*``
24
25 The ``toolset`` specifies the toolset name.  The selected toolset name
26 is provided in the :variable:`CMAKE_XCODE_PLATFORM_TOOLSET` variable.
27
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
32 ``buildsystem=<variant>``
33   Specify the buildsystem variant to use.
34   See the :variable:`CMAKE_XCODE_BUILD_SYSTEM` variable for allowed values.
35
36   For example, to select the original build system under Xcode 12,
37   run :manual:`cmake(1)` with the option :option:`-T buildsystem=1 <cmake -T>`.
38
39 Swift Support
40 ^^^^^^^^^^^^^
41
42 .. versionadded:: 3.4
43
44 When using the :generator:`Xcode` generator with Xcode 6.1 or higher,
45 one may enable the ``Swift`` language with the :command:`enable_language`
46 command or the :command:`project`.
47
48 Limitations
49 ^^^^^^^^^^^
50
51 The Xcode generator does not support per-configuration sources.
52 Code like the following will result in a generation error:
53
54 .. code-block:: cmake
55
56   add_executable(MyApp mymain-$<CONFIG>.cpp)