| 1 |
# Pkg config files |
| 2 |
|
| 3 |
[Pkg-config](https://en.wikipedia.org/wiki/Pkg-config) is a way for |
| 4 |
shared libraries to declare the compiler flags needed to use them. |
| 5 |
There are two different ways of generating Pkg-config files in Meson. |
| 6 |
The first way is to build them manually with the `configure_file` |
| 7 |
command. The second way is to use Meson's built in Pkg-config file |
| 8 |
generator. The difference between the two is that the latter is very |
| 9 |
simple and meant for basic use cases. The former should be used when |
| 10 |
you need to provide a more customized solution. |
| 11 |
|
| 12 |
In this document we describe the simple generator approach. It is used in the following way. |
| 13 |
|
| 14 |
```meson |
| 15 |
pkg = import('pkgconfig') |
| 16 |
libs = ... # the library/libraries users need to link against |
| 17 |
h = ['.', ...] # subdirectories of ${prefix}/${includedir} to add to header path |
| 18 |
pkg.generate(libraries : libs, |
| 19 |
subdirs : h, |
| 20 |
version : '1.0', |
| 21 |
name : 'libsimple', |
| 22 |
filebase : 'simple', |
| 23 |
description : 'A simple demo library.') |
| 24 |
``` |
| 25 |
|
| 26 |
This causes a file called `simple.pc` to be created and placed into |
| 27 |
the install directory during the install phase. |
| 28 |
|
| 29 |
More information on the pkg-config module and the parameters can be |
| 30 |
found on the [pkgconfig-module](Pkgconfig-module.md) page. |