1

In Meson, you get an opaque dependency object when you search for a library. How do you get the full path of the library that was found? In other words, what goes in "????" below?

compiler = meson.get_compiler('cpp')
extraLibDep = compiler.find_library('some library')
if extraLibDep.found()
   extraLibPath = ????
endif 

(The rataionale for wanting this info is that, if, after compilation, you want to package up your application, then you might need to ship some of the libraries with it. At least, this is the case on Windows and Mac.)

There is a way to get similar info when you're searching for a package, provided that Meson is using CMake to find the package, eg:

xercesDependency = dependency('XercesC',
                              required : true)
xercesLibPaths = xercesDependency.get_variable(cmake : 'PACKAGE_LIBRARIES')

But I can't find an equivalent for searching for, eg a library such as freetype or sqlite3.

(I have see How to get the include directories from a dependency in meson build system to which the only answer is "meson will handle all other things inside" but this isn't helpful when you want to export the information from meson.)

Matt Young
  • 21
  • 3
  • I just found this question after asking basically the same thing: https://stackoverflow.com/questions/76713785/get-the-library-file-name-and-path-of-a-dependency-in-meson-found-or-generated . – Kagetsuki Jul 19 '23 at 07:23

0 Answers0