From 494938365fa6b18a164653cf3999fefb9e86baba Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Thu, 11 Feb 2016 15:34:34 -0600 Subject: [PATCH] Extend libav check to find versions without pkg-config --- CMakeTests/CheckLib.cmake | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/CMakeTests/CheckLib.cmake b/CMakeTests/CheckLib.cmake index caa0d621cd..ba5e981f45 100644 --- a/CMakeTests/CheckLib.cmake +++ b/CMakeTests/CheckLib.cmake @@ -57,7 +57,23 @@ macro(check_libav) pkg_check_modules(LIBAV libavcodec>=54.35.0 libavformat>=54.20.4 libswscale>=2.1.1 libavutil>=52.3.0) else() - message("pkg-config is required to check for libav/ffmpeg") + # Attempt to find it through static means + set(LIBAV_LDFLAGS avformat avcodec swscale avutil) + set(CMAKE_REQUIRED_LIBRARIES ${LIBAV_LDFLAGS}) + CHECK_CXX_SOURCE_COMPILES( + "extern \"C\" { + #include + #include + #include + #include + } + int main(int argc, char **argv) + { + av_register_all(); + return 0; + }" + LIBAV_FOUND) + unset(CMAKE_REQUIRED_LIBRARIES) endif() if(LIBAV_FOUND) message("libav/ffmpeg found, enabling AVI frame dumps")