backend/ninja: replace ` ` with `_` in rust crate-names

Because spaces aren't allowed and result in compilation failures
pull/11066/head
Dylan Baker 2 years ago committed by Eli Schwartz
parent 8526b8c1a9
commit 9e9a9ac4de
  1. 4
      mesonbuild/backend/ninjabackend.py

@ -1878,8 +1878,8 @@ class NinjaBackend(backends.Backend):
args.extend(rustc.get_linker_always_args())
args += self.generate_basic_compiler_args(target, rustc, False)
# This matches rustc's default behavior.
args += ['--crate-name', target.name.replace('-', '_')]
# Rustc replaces - with _. spaces are not allowed, so we replace them with underscores
args += ['--crate-name', target.name.replace('-', '_').replace(' ', '_')]
depfile = os.path.join(target.subdir, target.name + '.d')
args += ['--emit', f'dep-info={depfile}', '--emit', 'link']
args += target.get_extra_args('rust')

Loading…
Cancel
Save