From 4df9006ca43338fea07b9d542f94da34369e43d3 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 16 Dec 2018 21:53:17 +0200 Subject: Can specify a string to print when dep not found. Closes #2407. --- docs/markdown/snippets/notfound_message.md | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 docs/markdown/snippets/notfound_message.md (limited to 'docs/markdown/snippets') 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`. -- cgit v1.1