diff options
| author | Gabríel Arthúr Pétursson <gabriel@system.is> | 2017-07-08 02:53:26 +0000 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-07-15 10:21:41 +0200 |
| commit | fd653d070d7d498ca8bb8a2430ed128d6239601d (patch) | |
| tree | c6326e4bacc10e3843f9ea8f63ded160633feee8 | |
| parent | 5d1e35fa0153cb40428d67ae6553d33b25e01ff8 (diff) | |
| download | meson-fd653d070d7d498ca8bb8a2430ed128d6239601d.tar.gz | |
Make base options accessible via get_option()
| -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 fe4af7516..a19db4981 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 58a145a87..8885e2b41 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 796c27f65..4058748f0 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 |
