docs: Document subproject(... required: false) [skip ci]

Somehow this was missed in the original PR #3885
pull/4589/head
Nirbheek Chauhan 6 years ago committed by Nirbheek Chauhan
parent febd3e8524
commit c502ddfebf
  1. 9
      docs/markdown/Reference-manual.md
  2. 6
      docs/markdown/Release-notes-for-0.48.0.md

@ -1356,6 +1356,12 @@ arguments:
- `version` keyword argument that works just like the one in - `version` keyword argument that works just like the one in
`dependency`. It specifies what version the subproject should be, `dependency`. It specifies what version the subproject should be,
as an example `>=1.0.1` as an example `>=1.0.1`
- `required` *(added 0.48.0)* By default, `required` is `true` and
Meson will abort if the subproject could not be setup. You can set
this to `false` and then use the `.found()` method on the [returned
object](#subproject-object). You may also pass the value of a
[`feature`](Build-options.md#features) option, same as
[`dependency()`](#dependency).
Note that you can use the returned [subproject Note that you can use the returned [subproject
object](#subproject-object) to access any variable in the object](#subproject-object) to access any variable in the
@ -2199,6 +2205,9 @@ an executable (e.g. `idl` files into source code and headers).
This object is returned by [`subproject()`](#subproject) and is an This object is returned by [`subproject()`](#subproject) and is an
opaque object representing it. opaque object representing it.
- `found()` *(added 0.48.0)* which returns whether the subproject was
successfully setup
- `get_variable(name)` fetches the specified variable from inside the - `get_variable(name)` fetches the specified variable from inside the
subproject. This is useful to, for instance, get a [declared subproject. This is useful to, for instance, get a [declared
dependency](#declare_dependency) from the [subproject](Subprojects.md). dependency](#declare_dependency) from the [subproject](Subprojects.md).

@ -305,3 +305,9 @@ To enable this, the following needs to be added to the `.wrap` file:
```ini ```ini
clone-recursive=true clone-recursive=true
``` ```
## `subproject()` function now supports the `required:` kwarg
This allows you to declare an optional subproject. You can now call `found()`
on the return value of the `subproject()` call to see if the subproject is
available before calling `get_variable()` to fetch information from it.

Loading…
Cancel
Save