diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-08-23 14:22:58 +0200 |
|---|---|---|
| committer | Jussi Pakkanen <jussi.pakkanen@mailbox.org> | 2025-08-25 16:49:40 +0300 |
| commit | 85f16a129bc5f6b2111187dd302405dc9554d817 (patch) | |
| tree | 0a779011c64fc5c9ba06bf63d49aa9a554be2511 | |
| parent | d4fb967f9dcffca0ba418fcd2220b0701e987f3e (diff) | |
| download | meson-85f16a129bc5f6b2111187dd302405dc9554d817.tar.gz | |
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 <pbonzini@redhat.com>
| -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.') |
