aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabrĂ­el ArthĂșr PĂ©tursson <gabriel@system.is>2017-07-08 02:53:26 +0000
committerJussi Pakkanen <jpakkane@gmail.com>2017-07-15 10:21:41 +0200
commitfd653d070d7d498ca8bb8a2430ed128d6239601d (patch)
treec6326e4bacc10e3843f9ea8f63ded160633feee8
parent5d1e35fa0153cb40428d67ae6553d33b25e01ff8 (diff)
downloadmeson-fd653d070d7d498ca8bb8a2430ed128d6239601d.zip
meson-fd653d070d7d498ca8bb8a2430ed128d6239601d.tar.gz
meson-fd653d070d7d498ca8bb8a2430ed128d6239601d.tar.bz2
Make base options accessible via get_option()
-rw-r--r--docs/markdown/Release-notes-for-0.42.0.md7
-rw-r--r--mesonbuild/interpreter.py4
-rw-r--r--test cases/common/47 options/meson.build4
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