Files
CMake/Help/prop_tgt/Swift_COMPILATION_MODE.rst
T
Evan Wilde c1d787e473 Swift: Add abstraction for compilation mode
Add a `CMAKE_Swift_COMPILATION_MODE` variable and corresponding
`Swift_COMPILATION_MODE` target property to control the compilation
mode.  Select among `wholemodule`, `singlefile`, and `incremental`.

Add policy CMP0157 to remove the default `-wmo` flags in favor of the
abstract setting.

Issue: #25366
2023-11-17 08:43:21 -05:00

34 lines
1.1 KiB
ReStructuredText

Swift_COMPILATION_MODE
----------------------
.. versionadded:: 3.29
Specify how Swift compiles a target.
The allowed values are:
.. include:: Swift_COMPILATION_MODE-VALUES.txt
Use :manual:`generator expressions <cmake-generator-expressions(7)>` to support
per-configuration specification. For example, the code:
.. code-block:: cmake
add_library(foo foo.swift)
set_property(TARGET foo PROPERTY
Swift_COMPILATION_MODE "$<IF:$<CONFIG:Release>,wholemodule,incremental>")
sets the Swift compilation mode to wholemodule mode in the release configuration
and sets the property to incremental mode in other configurations.
The property is initialized from the value of the
:variable:`CMAKE_Swift_COMPILATION_MODE` variable, if it is set. If the property
is not set or is empty, then CMake uses the default value ``incremental`` to
specify the swift compilation mode.
.. note::
This property only has effect when policy :policy:`CMP0157` is set to ``NEW``
prior to the first :command:`project` or :command:`enable_language` command
that enables the Swift language.