summaryrefslogtreecommitdiffstats
path: root/Help/prop_tgt/Swift_COMPILATION_MODE.rst
diff options
context:
space:
mode:
authorEvan Wilde <etceterawilde@gmail.com>2023-11-06 00:36:28 (GMT)
committerBrad King <brad.king@kitware.com>2023-11-17 13:43:21 (GMT)
commitc1d787e4734ca107e8ae084b3832e441651a6266 (patch)
tree9622a28a3c0e14caa452ac4ddb6733fa83564088 /Help/prop_tgt/Swift_COMPILATION_MODE.rst
parentc39384f54019adce87d676a7ed6d8e772ce5b7f8 (diff)
downloadCMake-c1d787e4734ca107e8ae084b3832e441651a6266.zip
CMake-c1d787e4734ca107e8ae084b3832e441651a6266.tar.gz
CMake-c1d787e4734ca107e8ae084b3832e441651a6266.tar.bz2
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
Diffstat (limited to 'Help/prop_tgt/Swift_COMPILATION_MODE.rst')
-rw-r--r--Help/prop_tgt/Swift_COMPILATION_MODE.rst33
1 files changed, 33 insertions, 0 deletions
diff --git a/Help/prop_tgt/Swift_COMPILATION_MODE.rst b/Help/prop_tgt/Swift_COMPILATION_MODE.rst
new file mode 100644
index 0000000..e26474a
--- /dev/null
+++ b/Help/prop_tgt/Swift_COMPILATION_MODE.rst
@@ -0,0 +1,33 @@
+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.