From 514d21e6a464a93dee2f2266623271007b87d99d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Sun, 10 Dec 2017 14:59:47 +0100 Subject: [PATCH] docs: Add documentation to dependency variables Meson is able to redefine variables when retrieving them from `pkg-config` dependencies. However, the documentation is missing. This patch adds documentation for this feature. --- docs/markdown/Dependencies.md | 15 +++++++++++++++ docs/markdown/Reference-manual.md | 4 +++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/markdown/Dependencies.md b/docs/markdown/Dependencies.md index bae3edc5e..90b4c1d37 100644 --- a/docs/markdown/Dependencies.md +++ b/docs/markdown/Dependencies.md @@ -43,6 +43,21 @@ You can pass the `opt_dep` variable to target construction functions whether the actual dependency was found or not. Meson will ignore non-found dependencies. +Meson also allows to get variables that are defined in the +`pkg-config` file. This can be done by using the +`get_pkgconfig_variable` function. + +```meson +zdep_prefix = zdep.get_pkgconfig_variable('prefix') +``` + +These variables can also be redefined by passing the `define_variable` +parameter, which might be useful in certain situations: + +```meson +zdep_prefix = zdep.get_pkgconfig_variable('prefix', define_variable: ['prefix', '/tmp']) +``` + The dependency detector works with all libraries that provide a `pkg-config` file. Unfortunately several packages don't provide pkg-config files. Meson has autodetection support for some of these, diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index dcedccdd5..f797da187 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -1618,7 +1618,9 @@ an external dependency with the following methods: - `get_pkgconfig_variable(varname)` (*Added 0.36.0*) will get the pkg-config variable specified, or, if invoked on a non pkg-config - dependency, error out + dependency, error out. (*Added 0.44.0*) You can also redefine a + variable by passing a list to the `define_variable` parameter + that can affect the retrieved variable: `['prefix', '/'])`. - `get_configtool_variable(varname)` (*Added 0.44.0*) will get the command line argument from the config tool (with `--` prepended), or,