diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2020-01-27 18:29:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-27 18:29:22 +0200 |
commit | a51c9af921d0ba05aa173b8a1a4351eacb575be0 (patch) | |
tree | 8207935e73c6c8e82f8c38c1ff130cbfe5642249 /docs/markdown/Subprojects.md | |
parent | 9e07f8d8e6bb088252ac11b3e663ff3d93c8020a (diff) | |
parent | 202c89d0b665a536a738c59dcde1f374047a346e (diff) | |
download | meson-a51c9af921d0ba05aa173b8a1a4351eacb575be0.zip meson-a51c9af921d0ba05aa173b8a1a4351eacb575be0.tar.gz meson-a51c9af921d0ba05aa173b8a1a4351eacb575be0.tar.bz2 |
Merge pull request #6423 from dcbaker/declare-dependency-variables
Add ability to set and query arbitrary variables on declare_dependency objects
Diffstat (limited to 'docs/markdown/Subprojects.md')
-rw-r--r-- | docs/markdown/Subprojects.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/docs/markdown/Subprojects.md b/docs/markdown/Subprojects.md index 91b1843..8232da9 100644 --- a/docs/markdown/Subprojects.md +++ b/docs/markdown/Subprojects.md @@ -55,6 +55,28 @@ should be named as `<project_name>_dep` (e.g. `gtest_dep`), and others can have There may be exceptions to these rules where common sense should be applied. +### Adding variables to the dependency + +*New in 0.54.0* + +In some cases a project may define special variables via pkg-config or cmake +that a caller needs to know about. Meson provides a `dependency.get_variable` +method to hide what kind of dependency is provided, and this is available to +subprojects as well. Use the `variables` keyword to add a dict of strings: + +```meson +my_dep = declare_dependency(..., variables : {'var': 'value', 'number': '3'}) +``` + +Which another project can access via: + +```meson +var = my_dep.get_variable(internal : 'var', cmake : 'CMAKE_VAR') +``` + +The values of the dict must be strings, as pkg-config and cmake will return +variables as strings. + ### Build options in subproject All Meson features of the subproject, such as project options keep |