OpenImageIO
OpenImageIO copied to clipboard
cmake: fix ffmpeg 5.1 detection
Description
Fix CMake detection of FFmpeg 5.1, which refactored location of libavcodec major version in https://github.com/FFmpeg/FFmpeg/commit/f2da2e1458b76a1d6c068673430b46cf2850bc51. Seen in Homebrew https://github.com/Homebrew/homebrew-core/pull/107244
Only fixes detection and I confirmed successful build. Not sure if any breaking changes in API, but at least still compiles with newer FFmpeg.
Original cmake output for master branch with FFmpeg 5.1:
❯ PKG_CONFIG_PATH=/usr/local/opt/ffmpeg/lib/pkgconfig cmake -S. -Bmaster 2>/dev/null | grep -i ffmpeg
-- FFmpeg 1.0 is outside the required range 3.0...
-- FFmpeg library not found
-- Try setting FFmpeg_ROOT ?
-- FFmpeg not found: ffmpeg plugin will not be built
And same with changes:
❯ PKG_CONFIG_PATH=/usr/local/opt/ffmpeg/lib/pkgconfig cmake -S. -Bfix 2>/dev/null | grep -i ffmpeg
-- Found FFmpeg 5.1
And confirming FFmpeg 4 is still detected:
❯ PKG_CONFIG_PATH=/usr/local/opt/ffmpeg@4/lib/pkgconfig cmake -S. -Bfix2 2>/dev/null | grep -i ffmpeg
-- Found FFmpeg 4.4
Tests
Checklist:
- [x] I have read the contribution guidelines.
- [ ] If this is more extensive than a small change to existing code, I have previously submitted a Contributor License Agreement (individual, and if there is any way my employers might think my programming belongs to them, then also corporate).
- [ ] I have updated the documentation, if applicable.
- [ ] I have ensured that the change is tested somewhere in the testsuite (adding new test cases if necessary).
- [x] My code follows the prevailing code style of this project.