Commit 365645d
committed
CMake: Handle multiple libraries being returned for Brotli
Brotli is built as three libraries: libbrotlienc, libbrotlidec, and
libbrotlicommon. When requesting the linker flags using pkg-config for
e.g. libbrotlidec, it will return both libbrotlidec and libbrotlicommon.
The FindBrotli*.cmake files ignore the names of the libraries returned
by pkg-config, and hardcode only the libbrotli{enc,dec} names. While
this is fine when using shared libraries (they contain an entry for
libbrotlicommon as required library in their headers), it will cause
linker errors when Brotli has been built as static libraries, due to
the missing symbols from libbrotlicommon being unknown to the linker.
This fixes FindBrotli*.cmake files by using the library names reported
by pkg-config, and applying find_library() to each of the libraries
to find their absolute paths. The well-known names of the libraries
are still used as fallback in case pkg-config is not available or in
case it does not provide the names. If any of the libraries is
missing, the corresponding BROTLI{ENC,DEC}_LIBRARIES is unset to
let find_package_handle_standard_args() report an error.1 parent 5e5f2cf commit 365645d
2 files changed
Lines changed: 31 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
19 | 25 | | |
20 | 26 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
25 | 36 | | |
26 | 37 | | |
27 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
19 | 25 | | |
20 | 26 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
25 | 37 | | |
26 | 38 | | |
27 | 39 | | |
| |||
0 commit comments