aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/Reference-manual.md
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2020-10-12 17:50:14 +0300
committerGitHub <noreply@github.com>2020-10-12 17:50:14 +0300
commitaae23dfff3aa8269a07b6d42479a00923bf73c6e (patch)
tree6ab489fab1e889141ac3560af38c3da477628b7b /docs/markdown/Reference-manual.md
parentba71fde18652ca156a35cd576dd9981202088424 (diff)
parent726b82205492a9e1f2dfd0fba96b237b51eeb428 (diff)
downloadmeson-aae23dfff3aa8269a07b6d42479a00923bf73c6e.zip
meson-aae23dfff3aa8269a07b6d42479a00923bf73c6e.tar.gz
meson-aae23dfff3aa8269a07b6d42479a00923bf73c6e.tar.bz2
Merge pull request #7740 from bonzini/fallback-false
Allow blocking/forcing automatic subproject search
Diffstat (limited to 'docs/markdown/Reference-manual.md')
-rw-r--r--docs/markdown/Reference-manual.md58
1 files changed, 43 insertions, 15 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index c1e509e..38ae558 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -440,33 +440,61 @@ system) with the given name with `pkg-config` and [with
CMake](Dependencies.md#cmake) if `pkg-config` fails. Additionally,
frameworks (OSX only) and [library-specific fallback detection
logic](Dependencies.md#dependencies-with-custom-lookup-functionality)
-are also supported. This function supports the following keyword
-arguments:
+are also supported.
+
+Dependencies can also be resolved in two other ways:
+
+* if the same name was used in a `meson.override_dependency` prior to
+ the call to `dependency`, the overriding dependency will be returned
+ unconditionally; that is, the overriding dependency will be used
+ independent of whether an external dependency is installed in the system.
+ Typically, `meson.override_dependency` will have been used by a
+ subproject.
+
+* by a fallback subproject which, if needed, will be brought into the current
+ build specification as if [`subproject()`](#subproject) had been called.
+ The subproject can be specified with the `fallback` argument. Alternatively,
+ if the `fallback` argument is absent, *since 0.55.0* Meson can
+ automatically identify a subproject as a fallback if a wrap file
+ [provides](Wrap-dependency-system-manual.md#provide-section) the
+ dependency, or if a subproject has the same name as the dependency.
+ In the latter case, the subproject must use `meson.override_dependency` to
+ specify the replacement, or Meson will report a hard error. See the
+ [Wrap documentation](Wrap-dependency-system-manual.md#provide-section)
+ for more details. This automatic search can be controlled using the
+ `allow_fallback` keyword argument.
+
+This function supports the following keyword arguments:
- `default_options` *(since 0.37.0)*: an array of default option values
that override those set in the subproject's `meson_options.txt`
(like `default_options` in [`project()`](#project), they only have
effect when Meson is run for the first time, and command line
arguments override any default options in build files)
-- `fallback`: specifies a subproject fallback to use in case the
- dependency is not found in the system. The value is an array
- `['subproj_name', 'subproj_dep']` where the first value is the name
+- `allow_fallback` (boolean argument, *since 0.56.0*): specifies whether Meson
+ should automatically pick a fallback subproject in case the dependency
+ is not found in the system. If `true` and the dependency is not found
+ on the system, Meson will fallback to a subproject that provides this
+ dependency. If `false`, Meson will not fallback even if a subproject
+ provides this dependency. By default, Meson will do so if `required`
+ is `true` or [`enabled`](Build-options.md#features); see the [Wrap
+ documentation](Wrap-dependency-system-manual.md#provide-section)
+ for more details.
+- `fallback` (string or array argument): manually specifies a subproject
+ fallback to use in case the dependency is not found in the system.
+ This is useful if the automatic search is not applicable or if you
+ want to support versions of Meson older than 0.55.0. If the value is an
+ array `['subproj_name', 'subproj_dep']`, the first value is the name
of the subproject and the second is the variable name in that
subproject that contains a dependency object such as the return
value of [`declare_dependency`](#declare_dependency) or
[`dependency()`](#dependency), etc. Note that this means the
fallback dependency may be a not-found dependency, in which
case the value of the `required:` kwarg will be obeyed.
- *(since 0.54.0)* `'subproj_dep'` argument can be omitted in the case the
- subproject used `meson.override_dependency('dependency_name', subproj_dep)`.
- In that case, the `fallback` keyword argument can be a single string instead
- of a list of 2 strings. *Since 0.55.0* the `fallback` keyword argument can be
- omitted when there is a wrap file or a directory with the same `dependency_name`,
- and subproject registered the dependency using
- `meson.override_dependency('dependency_name', subproj_dep)`, or when the wrap
- file has `dependency_name` in its `[provide]` section.
- See [Wrap documentation](Wrap-dependency-system-manual.md#provide-section)
- for more details.
+ *Since 0.54.0* the value can be a single string, the subproject name;
+ in this case the subproject must use
+ `meson.override_dependency('dependency_name', subproj_dep)`
+ to specify the dependency object used in the superproject.
- `language` *(since 0.42.0)*: defines what language-specific
dependency to find if it's available for multiple languages.
- `method`: defines the way the dependency is detected, the default is