Compiler checks must use per-subproject options

Fixes: #12202
pull/11822/merge
Xavier Claessens 1 year ago committed by Xavier Claessens
parent d5f17bc9ff
commit 025aea1dab
  1. 2
      mesonbuild/interpreter/compiler.py
  2. 4
      test cases/common/223 persubproject options/subprojects/sub2/meson.build

@ -261,7 +261,7 @@ class CompilerHolder(ObjectHolder['Compiler']):
for idir in i.to_string_list(self.environment.get_source_dir(), self.environment.get_build_dir()):
args.extend(self.compiler.get_include_args(idir, False))
if not kwargs['no_builtin_args']:
opts = self.environment.coredata.options
opts = coredata.OptionsView(self.environment.coredata.options, self.subproject)
args += self.compiler.get_option_compile_args(opts)
if mode is CompileCheckMode.LINK:
args.extend(self.compiler.get_option_link_args(opts))

@ -14,3 +14,7 @@ shared_library('lib1', 'foo.c')
# Parent project is c++11 but this one uses c++14 to build.
libcpp14 = library('lib2', 'foo.cpp')
meson.override_dependency('libcpp14', declare_dependency(link_with: libcpp14))
# Compiler checks should be using c++14 as well
cxx = meson.get_compiler('cpp')
assert(cxx.compiles(files('foo.cpp')))

Loading…
Cancel
Save