aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/snippets
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2019-05-08 16:09:06 -0700
committerDylan Baker <dylan@pnwbakers.com>2019-05-20 10:41:11 -0700
commitffe2a678d59b2d4184cadd5e4a8f31e8e6108968 (patch)
tree308d412c7e698fcc41b0b9626cb39b43e7064011 /docs/markdown/snippets
parent53c8852f47aa5e8ae9a1ac0c0d851b60dab1ea9e (diff)
downloadmeson-ffe2a678d59b2d4184cadd5e4a8f31e8e6108968.zip
meson-ffe2a678d59b2d4184cadd5e4a8f31e8e6108968.tar.gz
meson-ffe2a678d59b2d4184cadd5e4a8f31e8e6108968.tar.bz2
docs: Add docs for Dependency.get_variable
Diffstat (limited to 'docs/markdown/snippets')
-rw-r--r--docs/markdown/snippets/dependency_get_variable_method.md17
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/markdown/snippets/dependency_get_variable_method.md b/docs/markdown/snippets/dependency_get_variable_method.md
new file mode 100644
index 0000000..5804865
--- /dev/null
+++ b/docs/markdown/snippets/dependency_get_variable_method.md
@@ -0,0 +1,17 @@
+## Dependency objects now have a get_variable method
+
+This is a generic replacement for type specific variable getters such as
+`ConfigToolDependency.get_configtool_variable` and
+`PkgConfigDependency.get_pkgconfig_variable`, and is the only way to query
+such variables from cmake dependencies.
+
+This method allows you to get variables without knowing the kind of
+dependency you have.
+
+```meson
+dep = dependency('could_be_cmake_or_pkgconfig')
+# cmake returns 'YES', pkg-config returns 'ON'
+if ['YES', 'ON'].contains(dep.get_variable(pkg-config : 'var-name', cmake : 'COP_VAR_NAME', default : 'NO'))
+ error('Cannot build your project when dep is built with var-name support')
+endif
+```