Subproject object (subproject)

This object is returned by subproject() and is an opaque object representing it.

Returned by

Subproject object objects are returned by the following functions and methods:

Subproject object methods

subproject.found()

Returns whether the subproject was successfully setup.

Signature

(since 0.48.0)

bool found()


subproject.get_variable()

fetches the specified variable from inside the subproject. This is useful to, for instance, get a declare_dependency() from the subproject.

If the variable does not exist, the variable fallback is returned. If a fallback is not specified, then attempting to read a non-existing variable will cause a fatal error.

Signature

# fetches the specified variable from inside the subproject
any get_variable(
  str var_name,     # The name of the variable to query
  any [fallback],   # The fallback value to return if `var_name` does not exist
)

Arguments

Argument flattening is NOT SUPPORTED by this function.

The method subproject.get_variable() accepts the following positional arguments:

Name Type Description Tags
var_name str

The name of the variable to query

fallback any

The fallback value to return if var_name does not exist.

[optional]


The results of the search are