From c9351ce30c03d107279090da7825096951a705d3 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Fri, 29 Sep 2017 10:07:29 -0700 Subject: Add new array type option This exposes the already existing UserStringArrayOption class through the meson_options.txt. The intention is to provide a way for projects to take list/array type arguments and validate that all of the elements in that array are valid without using complex looping constructrs. --- docs/markdown/snippets/option-array-type.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 docs/markdown/snippets/option-array-type.md (limited to 'docs/markdown/snippets') diff --git a/docs/markdown/snippets/option-array-type.md b/docs/markdown/snippets/option-array-type.md new file mode 100644 index 0000000..f073dc1 --- /dev/null +++ b/docs/markdown/snippets/option-array-type.md @@ -0,0 +1,17 @@ +# An array type for user options + +Previously to have an option that took more than one value a string value would +have to be created and split, but validating this was difficult. A new array type +has been added to the meson_options.txt for this case. It works like a 'combo', but +allows more than one option to be passed. When used on the command line (with -D), +values are passed as a comma separated list. + +```meson +option('array_opt', type : 'array', choices : ['one', 'two', 'three'], value : ['one']) +``` + +These can be overwritten on the command line, + +```meson +meson _build -Darray_opt=two,three +``` -- cgit v1.1