How to give releative path for dirs option in meson build to find the thrid party library?
Asked Answered
F

1

5

I am trying to build custom gst-plugin which has third party library dependency.

With cc.find_library and dirs option (takes absolute path) I am able to build the setup.

But I want to include the relative paths, so that when others uses my package they don't have to change anything, just run the meson build. Is there any way to do the same: to add/include relative to search library in directories?

Footpoundsecond answered 6/11, 2017 at 10:19 Comment(4)
Is your 3rd party library given by source code? Is it feasible to make it a sub project of yours?Bout
@YasushiShoji ,I have library and the header files source code is not shared.Footpoundsecond
And you want to install where? can you edit your Q to add some example?Bout
@YasushiShoji ,Will install it using --prefix on to local directory.This I would do only if I can compile/build successfully.Footpoundsecond
S
15

find_library() does indeed require an absolute path. There is no way around that. You can use internal meson functionality to still succeed though:

cc.find_library('foo', dirs : meson.current_source_dir() + '/lib')

Setter answered 6/11, 2017 at 14:52 Comment(2)
I think that a better solution would be to put a dependency (install it) for example in /opt/<dependency_name_dir>/<dependency_name> directory, and then use cc.find_library('foo', dirs: '/opt/<dependency_name_dir>/<dependency_name>'). It wont interfere with the system in any way and will have its own place.Fayth
@KostiantynPonomarenko I don't see how creating untracked files over your operating system can be better.Hiles

© 2022 - 2024 — McMap. All rights reserved.