子專案物件 (subproject
)
此物件由 subproject()
返回,並且是不透明的物件,代表它。
由以下項目返回
子專案物件是由以下函數和方法返回
子專案物件方法
subproject.found()
返回子專案是否成功設置。
簽章
(自 0.48.0 版本起)
bool found()
subproject.get_variable()
從子專案內部獲取指定的變數。這對於,例如,從子專案取得 declare_dependency()
非常有用。
如果變數不存在,則返回變數 fallback
。 如果沒有指定 fallback,那麼嘗試讀取不存在的變數將會導致致命錯誤。
簽章
# 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
)
引數
此函數不支援引數扁平化。
方法 subproject.get_variable()
接受以下位置引數
名稱 | 類型 | 描述 | 標籤 |
---|---|---|---|
var_name |
str |
要查詢的變數名稱 |
|
fallback |
any |
如果 |
[可選] |
搜尋結果為