summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/markdown/Wrap-dependency-system-manual.md2
-rw-r--r--mesonbuild/cargo/interpreter.py3
2 files changed, 4 insertions, 1 deletions
diff --git a/docs/markdown/Wrap-dependency-system-manual.md b/docs/markdown/Wrap-dependency-system-manual.md
index 402dbe3e6..f2ca665ff 100644
--- a/docs/markdown/Wrap-dependency-system-manual.md
+++ b/docs/markdown/Wrap-dependency-system-manual.md
@@ -362,6 +362,8 @@ Some naming conventions need to be respected:
This is typically used as `extra_args += ['--cfg', 'foo']`.
- The `extra_deps` variable is pre-defined and can be used to add extra dependencies.
This is typically used as `extra_deps += dependency('foo')`.
+- The `features` variable is pre-defined and contains the list of features enabled
+ on this crate.
Since *1.5.0* Cargo wraps can also be provided with `Cargo.lock` file at the root
of (sub)project source tree. Meson will automatically load that file and convert
diff --git a/mesonbuild/cargo/interpreter.py b/mesonbuild/cargo/interpreter.py
index 818e8640b..c403f9707 100644
--- a/mesonbuild/cargo/interpreter.py
+++ b/mesonbuild/cargo/interpreter.py
@@ -129,9 +129,10 @@ class Interpreter:
def _create_package(self, pkg: PackageState, build: builder.Builder, subdir: str) -> T.List[mparser.BaseNode]:
ast: T.List[mparser.BaseNode] = [
+ build.assign(build.array([build.string(f) for f in pkg.features]), 'features'),
build.function('message', [
build.string('Enabled features:'),
- build.array([build.string(f) for f in pkg.features]),
+ build.identifier('features'),
]),
]
ast += self._create_dependencies(pkg, build)