diff --git a/mesonbuild/cargo/interpreter.py b/mesonbuild/cargo/interpreter.py index e73a905c8537..cea20381b925 100644 --- a/mesonbuild/cargo/interpreter.py +++ b/mesonbuild/cargo/interpreter.py @@ -766,7 +766,7 @@ def _create_lib(cargo: Manifest, build: builder.Builder, crate_type: manifest.CR dependencies.append(build.identifier(_extra_deps_varname())) posargs: T.List[mparser.BaseNode] = [ - build.string(fixup_meson_varname(cargo.package.name)), + build.string(fixup_meson_varname(cargo.lib.name or cargo.package.name)), build.string(cargo.lib.path), ]