aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/snippets
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2022-04-21 11:00:48 -0400
committerEli Schwartz <eschwartz93@gmail.com>2022-04-21 14:18:29 -0400
commit3c8343b4837744ae7dc1ee21eeefb93cd044b611 (patch)
treea354996fb89c4bd105536f30b1215774396defcf /docs/markdown/snippets
parent9528e7deb0e883efde90f7bca60277ad06d62d47 (diff)
downloadmeson-3c8343b4837744ae7dc1ee21eeefb93cd044b611.zip
meson-3c8343b4837744ae7dc1ee21eeefb93cd044b611.tar.gz
meson-3c8343b4837744ae7dc1ee21eeefb93cd044b611.tar.bz2
Allow deprecating an option for a new one
Diffstat (limited to 'docs/markdown/snippets')
-rw-r--r--docs/markdown/snippets/deprecated_for_option.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/markdown/snippets/deprecated_for_option.md b/docs/markdown/snippets/deprecated_for_option.md
new file mode 100644
index 0000000..c0a012c
--- /dev/null
+++ b/docs/markdown/snippets/deprecated_for_option.md
@@ -0,0 +1,16 @@
+## Deprecate an option and replace it with a new one
+
+The `deprecated` keyword argument can now take the name of a new option
+that replace this option. In that case, setting a value on the deprecated option
+will set the value on both the old and new names, assuming they accept the same
+values.
+
+```meson
+# A boolean option has been replaced by a feature with another name, old true/false values
+# are accepted by the new option for backward compatibility.
+option('o1', type: 'boolean', value: 'true', deprecated: 'o2')
+option('o2', type: 'feature', value: 'enabled', deprecated: {'true': 'enabled', 'false': 'disabled'})
+
+# A project option is replaced by a module option
+option('o3', type: 'string', value: '', deprecated: 'python.platlibdir')
+```