aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2017-05-09 09:52:19 +0100
committerGitHub <noreply@github.com>2017-05-09 09:52:19 +0100
commitbf54383d8aabd076a5893a3e849fd6788db77054 (patch)
treedbad646dc9a54322497bfd76e4c8741bace1f0b3 /docs/markdown
parent7053d9abfdef64c1f507173609fad4c9866441eb (diff)
parentdf48be051cb8a62d397cadf83feb7855f8e1b856 (diff)
downloadmeson-bf54383d8aabd076a5893a3e849fd6788db77054.zip
meson-bf54383d8aabd076a5893a3e849fd6788db77054.tar.gz
meson-bf54383d8aabd076a5893a3e849fd6788db77054.tar.bz2
Merge pull request #1762 from tp-m/docs-find-program-additional-paths
docs: how to make find_program() search additional directories
Diffstat (limited to 'docs/markdown')
-rw-r--r--docs/markdown/Reference-manual.md10
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index 00a891b..8d690de 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -266,6 +266,16 @@ Meson will also autodetect scripts with a shebang line and run them with the exe
`program_name2` and later positional arguments are used as fallback strings to search for. This is meant to be used for cases where the program may have many alternative names, such as `foo` and `foo.py`. The function will check for the arguments one by one and the first one that is found is returned. Meson versions earlier than 0.37.0 only accept one argument.
+If you need to check for a program in a non-standard location, you can just pass an absolute path to `find_program`, e.g.
+```
+setcap = find_program('setcap', '/usr/sbin/setcap', '/sbin/setcap', required : false)
+```
+
+It is also possible to pass an array to `find_program` in case you need to construct the set of paths to search on the fly:
+```
+setcap = find_program(['setcap', '/usr/sbin/setcap', '/sbin/setcap'], required : false)
+```
+
If none of the programs are found, Meson will abort. You can tell it not to by setting the keyword argument `required` to false, and then use the `.found()` method on the returned object to check whether it was found or not.
The returned object also has methods that are documented in the [object methods section](#external-program-object) below.