Skip to content

Commit 85f16a1

Browse files
bonzinijpakkane
authored andcommitted
coredata: check for per-subproject compiler options
If the parent project has not enabled a language, the child project's project-specific compiler option values are sitting in pending_options after initialize_from_subproject_call, and the option store has to be informed that they now exist. Fixes: #14939 Signed-off-by: Paolo Bonzini <[email protected]>
1 parent d4fb967 commit 85f16a1

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

mesonbuild/coredata.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,9 +565,12 @@ def set_options(self, opts_to_set: T.Dict[OptionKey, T.Any], subproject: str = '
565565

566566
return dirty
567567

568-
def add_compiler_options(self, c_options: MutableKeyedOptionDictType, lang: str, for_machine: MachineChoice) -> None:
568+
def add_compiler_options(self, c_options: MutableKeyedOptionDictType, lang: str, for_machine: MachineChoice,
569+
subproject: str) -> None:
569570
for k, o in c_options.items():
570571
assert k.subproject is None and k.machine is for_machine
572+
if subproject:
573+
k = k.evolve(subproject=subproject)
571574
if lang == 'objc' and k.name == 'c_std':
572575
# For objective C, always fall back to c_std.
573576
self.optstore.add_compiler_option('c', k, o)
@@ -577,7 +580,7 @@ def add_compiler_options(self, c_options: MutableKeyedOptionDictType, lang: str,
577580
self.optstore.add_compiler_option(lang, k, o)
578581

579582
def process_compiler_options(self, lang: str, comp: Compiler, subproject: str) -> None:
580-
self.add_compiler_options(comp.get_options(), lang, comp.for_machine)
583+
self.add_compiler_options(comp.get_options(), lang, comp.for_machine, subproject)
581584

582585
for key in comp.base_options:
583586
if subproject:

test cases/common/43 subproject options/subprojects/subproject/meson.build

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
project('subproject')
1+
project('subproject', 'c',
2+
default_options: {'c_std': 'c11'})
3+
4+
assert(get_option('c_std') == 'c11')
25

36
if get_option('opt')
47
error('option set when it should be unset.')

0 commit comments

Comments
 (0)