Previously pkg-config files generated by the pkgconfig modules for static libraries with dependencies could only be used in a dependencies with `static: true`. This was caused by the dependencies only appearing in Libs.private even if they are needed in the default linking mode. But a user of a dependency should not have to know if the default linking mode is static or dynamic; A dependency('somelib') call should always pull in all needed pieces into the build. Now for meson build static libraries passed via `libraries` to the generate method automatically promote dependencies to public.pull/3411/head
parent
7c37ca15f3
commit
3f7c6cf3d6
9 changed files with 74 additions and 3 deletions
@ -0,0 +1,12 @@ |
||||
## Improved generation of pkg-config files for static only libraries. |
||||
|
||||
Previously pkg-config files generated by the pkgconfig modules for static libraries |
||||
with dependencies could only be used in a dependencies with `static: true`. |
||||
|
||||
Now the generated file contains the needed dependencies libraries directly within |
||||
`Requires` and `Libs` for build static libraries passed via the `libraries` keyword |
||||
argument. |
||||
|
||||
Projects that install both a static and a shared version of a library should use |
||||
the result of `both_libraries` to the pkg config file generator or use |
||||
configure_file for more complicated setups. |
@ -0,0 +1,6 @@ |
||||
void libb_func(); |
||||
|
||||
int main() { |
||||
libb_func(); |
||||
return 0; |
||||
} |
@ -0,0 +1,5 @@ |
||||
project('app', ['c']) |
||||
|
||||
b = dependency('test-b') |
||||
|
||||
executable('app', 'app.c', dependencies : [b]) |
@ -0,0 +1,2 @@ |
||||
void liba_func() { |
||||
} |
@ -0,0 +1,5 @@ |
||||
void liba_func(); |
||||
|
||||
void libb_func() { |
||||
liba_func(); |
||||
} |
@ -0,0 +1,16 @@ |
||||
project('lib', ['c']) |
||||
|
||||
a = library('test-a', 'liba.c', install: true) |
||||
|
||||
b = library('test-b', 'libb.c', link_with: a, install: true) |
||||
|
||||
import('pkgconfig').generate( |
||||
version: '0.0', |
||||
description: 'test library', |
||||
filebase: 'test-b', |
||||
name: 'test library', |
||||
libraries: [b], |
||||
subdirs: ['.'] |
||||
) |
||||
|
||||
|
Loading…
Reference in new issue