|
|
|
name: subproject
|
|
|
|
returns: subproject
|
|
|
|
description: |
|
|
|
|
Takes the project specified in the positional argument and brings that
|
|
|
|
in the current build specification by returning a [[@subproject]] object.
|
|
|
|
Subprojects must always be placed inside
|
|
|
|
the `subprojects` directory at the top source directory. So for
|
|
|
|
example a subproject called `foo` must be located in
|
|
|
|
`${MESON_SOURCE_ROOT}/subprojects/foo`.
|
|
|
|
|
|
|
|
- `default_options` *(since 0.37.0)*: an array of default option values
|
Add support for meson.options as a replacement for meson_options.txt
We will still try to load `meson_options.txt` if `meson.options` doesn't
exist. Because there are some advantages to using `meson.options` even
with older versions of meson (such as better text editor handling)
we will not warn about the existence of a `meson.options` file if a
`meson_options.txt` file or symlink also exists.
The name `meson.options` was picked instead of alternative proposals,
such as `meson_options.build` for a couple of reasons:
1. meson.options is shorter
2. While the syntax is the same, only the `option()` function may be
called in meson.options, while, it may not be called in meson.build
3. While the two files share a syntax and elementary types (strings,
arrays, etc), they have different purposes: `meson.build` declares
build targets, `meson.options` declares options. This is similar to
the difference between C's `.c` and `.h` extensions.
As an implementation detail `Interpreter.option_file` has been removed,
as it is used exactly once, in the `project()` call to read the options,
and we can just calculate it there and not store it.
Fixes: #11176
2 years ago
|
|
|
that override those set in the subproject's `meson.options`
|
|
|
|
(like `default_options` in `project`, they only have effect when
|
|
|
|
Meson is run for the first time, and command line arguments override
|
|
|
|
any default options in build files).
|
|
|
|
*(since 0.54.0)*: `default_library` built-in option can also be overridden.
|
|
|
|
*(since 1.2.0)*: A dictionary may be passed instead of array.
|
|
|
|
- `version`: works just like the same as in `dependency`.
|
|
|
|
It specifies what version the subproject should be, as an example `>=1.0.1`
|
|
|
|
- `required` *(since 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 [[@subproject]]
|
|
|
|
object. You may also pass the value of a
|
|
|
|
[`feature`](Build-options.md#features) option, same as
|
|
|
|
[[dependency]].
|
|
|
|
|
|
|
|
Note that you can use the returned [[@subproject]] object
|
|
|
|
to access any variable in the
|
|
|
|
subproject. However, if you want to use a dependency object from
|
|
|
|
inside a subproject, an easier way is to use the `fallback:` keyword
|
|
|
|
argument to [[dependency]].
|
|
|
|
|
|
|
|
[See additional documentation](Subprojects.md).
|
|
|
|
|
|
|
|
posargs:
|
|
|
|
subproject_name:
|
|
|
|
type: str
|
|
|
|
description: |
|
|
|
|
Name of the subproject. The subproject must exist in the `subprojects`
|
|
|
|
directory (or the directory specified in the `subproject_dir` of
|
|
|
|
[[project]]) as a directory or wrap file.
|
|
|
|
|
|
|
|
kwargs:
|
|
|
|
default_options:
|
|
|
|
type: list[str] | dict[str | bool | int | list[str]]
|
|
|
|
since: 0.37.0
|
|
|
|
description: |
|
|
|
|
An array of default option values
|
Add support for meson.options as a replacement for meson_options.txt
We will still try to load `meson_options.txt` if `meson.options` doesn't
exist. Because there are some advantages to using `meson.options` even
with older versions of meson (such as better text editor handling)
we will not warn about the existence of a `meson.options` file if a
`meson_options.txt` file or symlink also exists.
The name `meson.options` was picked instead of alternative proposals,
such as `meson_options.build` for a couple of reasons:
1. meson.options is shorter
2. While the syntax is the same, only the `option()` function may be
called in meson.options, while, it may not be called in meson.build
3. While the two files share a syntax and elementary types (strings,
arrays, etc), they have different purposes: `meson.build` declares
build targets, `meson.options` declares options. This is similar to
the difference between C's `.c` and `.h` extensions.
As an implementation detail `Interpreter.option_file` has been removed,
as it is used exactly once, in the `project()` call to read the options,
and we can just calculate it there and not store it.
Fixes: #11176
2 years ago
|
|
|
that override those set in the subproject's `meson.options`
|
|
|
|
(like `default_options` in [[project]], they only have effect when
|
|
|
|
Meson is run for the first time, and command line arguments override
|
|
|
|
any default options in build files).
|
|
|
|
*(since 0.54.0)*: `default_library` built-in option can also be overridden.
|
|
|
|
*(since 1.2.0)*: A dictionary may now be passed.
|
|
|
|
|
|
|
|
version:
|
|
|
|
type: str
|
|
|
|
description: |
|
|
|
|
Works just like the same as in [[dependency]].
|
|
|
|
It specifies what version the subproject should be, as an example `>=1.0.1`.
|
|
|
|
|
|
|
|
required:
|
|
|
|
type: bool | feature
|
|
|
|
since: 0.48.0
|
|
|
|
default: true
|
|
|
|
description: |
|
|
|
|
Works just the same as in [[dependency]].
|