diff options
| -rw-r--r-- | mesonbuild/coredata.py | 7 | ||||
| -rw-r--r-- | test cases/common/43 subproject options/subprojects/subproject/meson.build | 5 |
2 files changed, 9 insertions, 3 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 026c02463..1200fb7b2 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -565,9 +565,12 @@ class CoreData: return dirty - def add_compiler_options(self, c_options: MutableKeyedOptionDictType, lang: str, for_machine: MachineChoice) -> None: + def add_compiler_options(self, c_options: MutableKeyedOptionDictType, lang: str, for_machine: MachineChoice, + subproject: str) -> None: for k, o in c_options.items(): assert k.subproject is None and k.machine is for_machine + if subproject: + k = k.evolve(subproject=subproject) if lang == 'objc' and k.name == 'c_std': # For objective C, always fall back to c_std. self.optstore.add_compiler_option('c', k, o) @@ -577,7 +580,7 @@ class CoreData: self.optstore.add_compiler_option(lang, k, o) def process_compiler_options(self, lang: str, comp: Compiler, subproject: str) -> None: - self.add_compiler_options(comp.get_options(), lang, comp.for_machine) + self.add_compiler_options(comp.get_options(), lang, comp.for_machine, subproject) for key in comp.base_options: if subproject: diff --git a/test cases/common/43 subproject options/subprojects/subproject/meson.build b/test cases/common/43 subproject options/subprojects/subproject/meson.build index d00a024ea..548d7b4e3 100644 --- a/test cases/common/43 subproject options/subprojects/subproject/meson.build +++ b/test cases/common/43 subproject options/subprojects/subproject/meson.build @@ -1,4 +1,7 @@ -project('subproject') +project('subproject', 'c', + default_options: {'c_std': 'c11'}) + +assert(get_option('c_std') == 'c11') if get_option('opt') error('option set when it should be unset.') |
