aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/snippets
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-05-21 21:57:05 +0300
committerGitHub <noreply@github.com>2019-05-21 21:57:05 +0300
commite9bd7d49bdc8c630cca3bf4cc02c437841b6aaf6 (patch)
tree3a7c2127d8ca71027248589d5d326c3bb23ace35 /docs/markdown/snippets
parent60f34a1f51d455598143c1c55fd49a5eb1bb1fd6 (diff)
parent27b6c62ffdf51fed9a55ecfdd4ed47ac2ea79c1e (diff)
downloadmeson-e9bd7d49bdc8c630cca3bf4cc02c437841b6aaf6.zip
meson-e9bd7d49bdc8c630cca3bf4cc02c437841b6aaf6.tar.gz
meson-e9bd7d49bdc8c630cca3bf4cc02c437841b6aaf6.tar.bz2
Merge pull request #5372 from dcbaker/get_variable
Dependency.get_variable method
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..aaeac9c
--- /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_value : 'NO'))
+ error('Cannot build your project when dep is built with var-name support')
+endif
+```