diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2017-12-05 01:10:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-05 01:10:50 +0200 |
commit | bc83c58d37421b84c5420356a79e04ade2b851a7 (patch) | |
tree | 1c47671d6d458ac4d7ec367d3cac716abedf8da8 /docs/markdown/snippets | |
parent | 87e6201214eda0941d2a2279e12a575fc27d21bb (diff) | |
parent | d3dcef7efc1df3b7a645eb6dc75c4a66a9131cb9 (diff) | |
download | meson-bc83c58d37421b84c5420356a79e04ade2b851a7.zip meson-bc83c58d37421b84c5420356a79e04ade2b851a7.tar.gz meson-bc83c58d37421b84c5420356a79e04ade2b851a7.tar.bz2 |
Merge pull request #2731 from mesonbuild/disabler
Created disabler object type
Diffstat (limited to 'docs/markdown/snippets')
-rw-r--r-- | docs/markdown/snippets/disabler.md | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/docs/markdown/snippets/disabler.md b/docs/markdown/snippets/disabler.md new file mode 100644 index 0000000..1323048 --- /dev/null +++ b/docs/markdown/snippets/disabler.md @@ -0,0 +1,33 @@ +# Added disabler object + +A disabler object is a new kind of object that has very specific +semantics. If it is used as part of any other operation such as an +argument to a function call, logical operations etc, it will cause the +operation to not be evaluated. Instead the return value of said +operation will also be the disabler object. + +For example if you have an setup like this: + +```meson +dep = dependency('foo') +lib = shared_library('mylib', 'mylib.c', + dependencies : dep) +exe = executable('mytest', 'mytest.c', + link_with : lib) +test('mytest', exe) +``` + +If you replace the dependency with a disabler object like this: + +```meson +dep = disabler() +lib = shared_library('mylib', 'mylib.c', + dependencies : dep) +exe = executable('mytest', 'mytest.c', + link_with : lib) +test('mytest', exe) +``` + +Then the shared library, executable and unit test are not +created. This is a handy mechanism to cut down on the number of `if` +statements. |