diff options
-rw-r--r-- | docs/markdown/Release-notes-for-0.42.0.md | 7 | ||||
-rw-r--r-- | mesonbuild/interpreter.py | 4 | ||||
-rw-r--r-- | test cases/common/47 options/meson.build | 4 |
3 files changed, 15 insertions, 0 deletions
diff --git a/docs/markdown/Release-notes-for-0.42.0.md b/docs/markdown/Release-notes-for-0.42.0.md index fe4af75..a19db49 100644 --- a/docs/markdown/Release-notes-for-0.42.0.md +++ b/docs/markdown/Release-notes-for-0.42.0.md @@ -37,6 +37,13 @@ pkg.generate(libraries : libs, extra_cflags : '-Dfoo' ) ``` +## Base options accessible via get_option() + +Base options are now accessible via the get_option() function. +```meson +uses_lto = get_option('b_lto') +``` + ## Allow crate type configuration for Rust compiler Rust targets now take an optional `rust_crate_type` keyword, allowing diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 58a145a..8885e2b 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1655,6 +1655,10 @@ class Interpreter(InterpreterBase): raise InterpreterException('Argument required for get_option.') optname = args[0] try: + return compilers.base_options[optname].value + except KeyError: + pass + try: return self.environment.get_coredata().get_builtin_option(optname) except RuntimeError: pass diff --git a/test cases/common/47 options/meson.build b/test cases/common/47 options/meson.build index 796c27f..4058748 100644 --- a/test cases/common/47 options/meson.build +++ b/test cases/common/47 options/meson.build @@ -12,6 +12,10 @@ if get_option('combo_opt') != 'combo' error('Incorrect value to combo option.') endif +if get_option('b_lto') != false + error('Incorrect value in base option.') +endif + if get_option('includedir') != 'include' error('Incorrect value in builtin option.') endif |