Description
This is a whole can of worms. The documentation regarding the dependency()
function in meson gives a nice impression on all the things one can / has to consider when dealing with dependencies.
How does fpm find dependencies now?
Currently, we assume the compiler can find external libraries and include files all by itself.
This works fine for system libraries, but usually there are packages under different prefixes like /opt
or in the users home which could also be used, but are not included by default.
Using a dependency tool
A somewhat standard way to handle non-system dependencies are pkg-config
or cmake
package files, some platforms might provide their own like OSX frameworks. Also some packages are known to provide incorrect package files.
Using environment variables
An third-party library usually provides a way to make itself known to the system, using environment variables like CPATH
to add include directories, LIBRARY_PATH
to add to the library search path and LD_LIBRARY_PATH
to add to the runtime load path. This mechanism allows fpm to automatically pick up third-party dependencies by relying on the compiler.
Setup scripts / environment modules
Setting those variables in the first place is tricky, usually third-party libraries provide scripts which can be sourced by the shell or an environment module that can be loaded. Sometimes those scripts and modules are not working correctly as well. This is a common issue with environment modules which miss certain crucial environment variables (missing CMAKE_PREFIX_PATH
is a classic).
As a developer there is nothing more painful than working in a broken environment. Either because some overzealous setup script in /etc/profile.d
messes with all other packages, an environment module exports the wrong paths, or a pc
file with a typo won't be recognized.
Can we / Should we do something about this?