subproject()
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 that override those set in the subproject'smeson.options(likedefault_optionsinproject, 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_librarybuilt-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 independency. It specifies what version the subproject should be, as an example>=1.0.1 -
required(since 0.48.0): By default,requiredistrueand Meson will abort if the subproject could not be setup. You can set this tofalseand then use the.found()method on thesubprojectobject. You may also pass the value of afeatureoption, same asdependency().
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().
Signature
# Takes the project specified in the positional argument and brings that
subproject subproject(
str subproject_name, # Name of the subproject
# Keyword arguments:
default_options : array[str] | dict[str | bool | int | array[str]] # An array of default option values
required : bool | feature # Works just the same as in dependency().
version : str # Works just like the same as in dependency().
)
Arguments
The function subproject() accepts the following positional arguments:
| Name | Type | Description | Tags |
|---|---|---|---|
subproject_name |
str |
Name of the subproject. The subproject must exist in the |
|
Finally, subproject()
accepts the following keyword arguments:
| Name | Type | Description | Tags |
|---|---|---|---|
default_options |
array[str] | dict[str | bool | int | array[str]] |
An array of default option values
that override those set in the subproject's |
(since 0.37.0) |
required |
bool | feature
|
Works just the same as in |
(since 0.48.0)
|
version |
str |
Works just like the same as in |
|
The results of the search are