oz10
oz10

Reputation: 158254

When defining external dependencies in meson, can you add search paths?

When defining a target in meson, you can declare dependencies on external projects using the following syntax:

zdep = dependency('zlib', version : '>=1.2.8')
exe = executable('zlibprog', 'prog.c', dependencies : zdep)

This checks the standard include locations, which works well on Linux, but not so well on other platforms.

Is there a way to add additional include and library paths for meson to check when declaring dependencies?

Upvotes: 4

Views: 3315

Answers (1)

Yasushi Shoji
Yasushi Shoji

Reputation: 4274

As the documentation says: dependency() "Finds an external dependency [...] with pkg-config if possible and with library-specific fallback detection logic otherwise."

So, if you mean to set PKG_CONFIG_PATH, you can do that as usual:

$ export PKG_CONFIG_PATH=/wherever/your/installed/dir/is/
$ meson ....

Or, you can use back-end specific variables, ie. BOOST_ROOT. Check the doc for more info.

If you ment to find other libraries not using pkg-config, you can add a dirs keyword argument to point to the directory your libraries are in.

Upvotes: 3

Related Questions