fix: Use PkgConfig for WebP and WebM#1400
Conversation
wbruna
left a comment
There was a problem hiding this comment.
Pretty sure we shouldn't assume pkg-config will always be available, e.g. on Windows. I believe it would be best to call pkg_check_modules as a fallback, in case the CMake module isn't found.
PkgConfig is the standard approach to locating and using system libraries. It does not rely on the library having been built with CMake, improving compatibility. webpmux is the library name; it should not be prefixed with lib. See: webmproject/libwebp@bfad7ab Closes: leejet#1399
That's a good point. I've done as you suggested, only use PkgConfig if it's available. |
|
This change appears to have broken CI (link error with Also, I think there are two issues in the current implementation:
|
…o cmake if pc not found
Done! I added an alias so libwebpmux and webpmux both work in all cases. I undid the modifications to examples/{cli,server}.
I've addressed that by trying the CMake approach first, then the PkgConfig approach. I also used
I added webpmux. This wasn't necessary on my system, but it makes sense to have it, and it still works. |
| @@ -1,4 +1,4 @@ | |||
| cmake_minimum_required(VERSION 3.12) | |||
| cmake_minimum_required(VERSION 4.1) | |||
There was a problem hiding this comment.
CMake 4.1 seems to be younger than a year; this would exclude most current Linux distros (e.g. Debian Stable has 3.31.6).
PkgConfig is the standard approach to locating and using system libraries. It does not rely on the library having been built with CMake, improving compatibility.
webpmux is the library name; it should not be prefixed with lib. See: webmproject/libwebp@bfad7ab
Closes: #1399