Merge pull request #2310 from hvenev/reconfigure-get_option

Fix get_option() for base options on reconfigure.
pull/2207/head
Jussi Pakkanen 8 years ago committed by GitHub
commit 9c834a4ecd
  1. 9
      mesonbuild/interpreter.py
  2. 5
      run_unittests.py
  3. 1
      test cases/common/47 options/meson.build
  4. 5
      test cases/unit/13 reconfigure/meson.build

@ -1698,11 +1698,11 @@ class Interpreter(InterpreterBase):
raise InterpreterException('Argument required for get_option.')
optname = args[0]
try:
return compilers.base_options[optname].value
return self.environment.get_coredata().base_options[optname].value
except KeyError:
pass
try:
return self.environment.get_coredata().get_builtin_option(optname)
return self.environment.coredata.get_builtin_option(optname)
except RuntimeError:
pass
try:
@ -1727,6 +1727,11 @@ class Interpreter(InterpreterBase):
return self.coredata.external_args[lang]
except KeyError:
pass
# Some base options are not defined in some environments, return the default value.
try:
return compilers.base_options[optname].value
except KeyError:
pass
raise InterpreterException('Tried to access unknown option "%s".' % optname)
@noKwargs

@ -1948,6 +1948,11 @@ endian = 'little'
crossfile.flush()
self.init(testdir, ['--cross-file='+crossfile.name])
def test_reconfigure(self):
testdir = os.path.join(self.unit_test_dir, '13 reconfigure')
self.init(testdir, ['-Db_lto=true'], default_args=False)
self.build('reconfigure')
class LinuxArmCrossCompileTests(BasePlatformTests):
'''

@ -12,6 +12,7 @@ if get_option('combo_opt') != 'combo'
error('Incorrect value to combo option.')
endif
# If the default changes, update test cases/unit/13 reconfigure
if get_option('b_lto') != false
error('Incorrect value in base option.')
endif

@ -0,0 +1,5 @@
project('reconfigure test', ['c'])
if get_option('b_lto') != true
error('b_lto not set')
endif
Loading…
Cancel
Save