From 3596b6b19a0e5bf6ce65a640448d459c85180184 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 8 Feb 2022 10:25:36 +0000 Subject: ninjabackend: fix rust program names with dashes This substitution matches the behaviour of rustc[1] when inferring crate name based on file name. [1]: https://github.com/rust-lang/rust/tree/4e8fb743ccbec27344b2dd42de7057f41d4ebfdd/compiler/rustc_session/src/output.rs#L88 --- mesonbuild/backend/ninjabackend.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mesonbuild') diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 080d009..f4df789 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1709,7 +1709,8 @@ class NinjaBackend(backends.Backend): args.extend(rustc.get_linker_always_args()) args += self.generate_basic_compiler_args(target, rustc, False) - args += ['--crate-name', target.name] + # This matches rustc's default behavior. + args += ['--crate-name', target.name.replace('-', '_')] depfile = os.path.join(target.subdir, target.name + '.d') args += ['--emit', f'dep-info={depfile}', '--emit', 'link'] args += target.get_extra_args('rust') -- cgit v1.1