On Mon, Dec 19, 2016 at 5:28 PM, Matthieu Gautier <
d...@mgautier.fr> wrote:
> 1. Discovering external libraries without pkg-config files.
>
> Not all libraries have a libfoo.pc file.
> I end to have custom meson code to find if the libfoo.(a|so) is
> available (and associated include dir) using find_library and has_header
> methods.
>
> This ends to duplicated code with just the lib name changing. Is there a
> way to factorize this code ? Is meson project is open to such a
> functionality ?
You can use a foreach loop with an array that has your data. However
the best possible fix is to get upstream to add pkg-config files to
their projects. Anything else is fragile and just waiting to fail on
you unexpectedly.
> 2. Using external libraries without pkg-config
>
> I currently use declare_dependency to create a custom dependency
> specifying the lib I want to use but also the -I/my/dir flags.
> But it seems that this is mainly for use in subprojects.
That is exactly how to do it. It does not matter whether they contain
only external stuff or internal as well. It all works.
> Is there a way to add a .a file to the list of objects of a static lib ?
> I try to add the object return by find_library but meson refuse it
> because it is not the right type. And if I want to pass a string, I have
> to found the full path, and I don't know it (this why I use find_library).
Put it in dependencies. Meson will then use it automatically when you
use the self built library.