summaryrefslogtreecommitdiff
path: root/docs/markdown/snippets
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-12-16 21:53:17 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2018-12-19 23:27:05 +0200
commit2f15793bf71923145ae834b286287f40da854bd9 (patch)
treece43002c18a3594401574a8745ba8a0b22939f91 /docs/markdown/snippets
parenta7d3d5de5a893d1a93ea3124fff01ca8de1f5ab7 (diff)
downloadmeson-missmessage.tar.gz
Can specify a string to print when dep not found. Closes #2407.missmessage
Diffstat (limited to 'docs/markdown/snippets')
-rw-r--r--docs/markdown/snippets/notfound_message.md38
1 files changed, 38 insertions, 0 deletions
diff --git a/docs/markdown/snippets/notfound_message.md b/docs/markdown/snippets/notfound_message.md
new file mode 100644
index 000000000..d73c6b2bc
--- /dev/null
+++ b/docs/markdown/snippets/notfound_message.md
@@ -0,0 +1,38 @@
+## New `not_found_message` for dependency
+
+You can now specify a `not_found_message` that will be printed if the
+specified dependency was not found. The point is to convert constructs
+that look like this:
+
+```meson
+d = dependency('something', required: false)
+if not d.found()
+ message('Will not be able to do something.')
+endif
+```
+
+Into this:
+
+```meson
+d = dependency('something',
+ required: false,
+ not_found_message: 'Will not be able to do something.')
+```
+
+Or constructs like this:
+
+```meson
+d = dependency('something', required: false)
+if not d.found()
+ error('Install something by doing XYZ.')
+endif
+```
+
+into this:
+
+```meson
+d = dependency('something',
+ not_found_message: 'Install something by doing XYZ.')
+```
+
+Which works, because the default value of `required` is `true`.