aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/markdown/Reference-manual.md2
-rw-r--r--docs/markdown/snippets/notfound_message.md38
2 files changed, 40 insertions, 0 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index 2fc61d5..8d0d123 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -395,6 +395,8 @@ are also supported. This function supports the following keyword arguments:
the build machine system rather than the host system (i.e. where the
cross compiled binary will run on), usually only needed if you build
a tool to be used during compilation.
+- `not_found_message` *(added 0.50.0)* is an optional string that will
+ be printed as a `message()` if the dependency was not found.
- `required`, when set to false, Meson will proceed with the build
even if the dependency is not found. Since *0.47.0* the value of a
[`feature`](Build-options.md#features) option can also be passed.
diff --git a/docs/markdown/snippets/notfound_message.md b/docs/markdown/snippets/notfound_message.md
new file mode 100644
index 0000000..d73c6b2
--- /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`.