Commit 9a6d50b
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 (instead of hardcoding them), and applying find_library()
to each of the libraries to find their absolute paths. 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 9a6d50b
2 files changed
Lines changed: 19 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
25 | 30 | | |
26 | 31 | | |
27 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
| |||
0 commit comments