diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-12-29 18:57:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-29 18:57:21 +0200 |
commit | 3b495c397ec1baffe99d63031f2b03301b7f6ba5 (patch) | |
tree | 660439db681ece26c622af11eff2535c507fca1c /docs | |
parent | 3d7c32a34e9d7a1f0e0c5c701f1afdf411b0194c (diff) | |
parent | b6cede2928e80d6bd0512c82ad6787c03faae1e6 (diff) | |
download | meson-3b495c397ec1baffe99d63031f2b03301b7f6ba5.zip meson-3b495c397ec1baffe99d63031f2b03301b7f6ba5.tar.gz meson-3b495c397ec1baffe99d63031f2b03301b7f6ba5.tar.bz2 |
Merge pull request #4672 from xclaesse/find-library-headers
find_library: Add 'has_headers' kwarg
Diffstat (limited to 'docs')
-rw-r--r-- | docs/markdown/Reference-manual.md | 16 | ||||
-rw-r--r-- | docs/markdown/snippets/find_library_header.md | 21 |
2 files changed, 33 insertions, 4 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index 8d0d123..92a7aed 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -1704,7 +1704,10 @@ the following methods: option can also be passed to the `required` keyword argument. *Since 0.49.0* if the keyword argument `disabler` is `true` and the dependency couldn't be found, return a [disabler object](#disabler-object) - instead of a not-found dependency. + instead of a not-found dependency. *Since 0.50.0* the `has_headers` keyword + argument can be a list of header files that must be found as well, using + `has_header()` method. All keyword arguments prefixed with `header_` will be + passed down to `has_header()` method with the prefix removed. - `first_supported_argument(list_of_strings)`, given a list of strings, returns the first argument that passes the `has_argument` @@ -1760,7 +1763,9 @@ the following methods: the `prefix` keyword. In order to look for headers in a specific directory you can use `args : '-I/extra/include/dir`, but this should only be used in exceptional cases for includes that can't be - detected via pkg-config and passed via `dependencies`. + detected via pkg-config and passed via `dependencies`. Since *0.50.0* the + `required` keyword argument can be used to abort if the header cannot be + found. - `has_header` returns true if the specified header *exists*, and is faster than `check_header()` since it only does a pre-processor check. @@ -1769,13 +1774,16 @@ the following methods: the `prefix` keyword. In order to look for headers in a specific directory you can use `args : '-I/extra/include/dir`, but this should only be used in exceptional cases for includes that can't be - detected via pkg-config and passed via `dependencies`. + detected via pkg-config and passed via `dependencies`. Since *0.50.0* the + `required` keyword argument can be used to abort if the header cannot be + found. - `has_header_symbol(headername, symbolname)` allows one to detect whether a particular symbol (function, variable, #define, type definition, etc) is declared in the specified header, you can specify external dependencies to use with `dependencies` keyword - argument. + argument. Since *0.50.0* the `required` keyword argument can be used to abort + if the symbol cannot be found. - `has_member(typename, membername)` takes two arguments, type name and member name and returns true if the type has the specified diff --git a/docs/markdown/snippets/find_library_header.md b/docs/markdown/snippets/find_library_header.md new file mode 100644 index 0000000..55597ab --- /dev/null +++ b/docs/markdown/snippets/find_library_header.md @@ -0,0 +1,21 @@ +## Find library with its headers + +The `find_library()` method can now also verify if the library's headers are +found in a single call, using the `has_header()` method internally. + +```meson +# Aborts if the 'z' library is found but not its header file +zlib = find_library('z', has_headers : 'zlib.h') +# Returns not-found if the 'z' library is found but not its header file +zlib = find_library('z', has_headers : 'zlib.h', required : false) +``` + +Any keyword argument with the `header_` prefix passed to `find_library()` will +be passed to the `has_header()` method with the prefix removed. + +```meson +libfoo = find_library('foo', + has_headers : ['foo.h', 'bar.h'], + header_prefix : '#include <baz.h>', + header_include_directories : include_directories('.')) +``` |