aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/snippets
diff options
context:
space:
mode:
Diffstat (limited to 'docs/markdown/snippets')
-rw-r--r--docs/markdown/snippets/override-find-program-meson.md38
1 files changed, 38 insertions, 0 deletions
diff --git a/docs/markdown/snippets/override-find-program-meson.md b/docs/markdown/snippets/override-find-program-meson.md
new file mode 100644
index 0000000..5d281cd
--- /dev/null
+++ b/docs/markdown/snippets/override-find-program-meson.md
@@ -0,0 +1,38 @@
+## New override of `find_program('meson')`
+
+In some cases, it has been useful for build scripts to access the Meson command
+used to invoke the build script. This has led to various ad-hoc solutions that
+can be very brittle and project-specific.
+
+```meson
+meson_prog = find_program('meson')
+```
+
+This call will supply the build script with an external program pointing at the
+invoked Meson.
+
+Because Meson also uses `find_program` for program lookups internally, this
+override will also be handled in cases similar to the following:
+
+```meson
+custom_target(
+ # ...
+ command: [
+ 'meson',
+ ],
+ # ...
+)
+
+run_command(
+ 'meson',
+ # ...
+)
+
+run_target(
+ 'tgt',
+ command: [
+ 'meson',
+ # ...
+ ]
+)
+```