Extend libav check to find versions without pkg-config

This commit is contained in:
Ryan Houdek 2016-02-11 15:34:34 -06:00
parent 585761a456
commit 494938365f
1 changed files with 17 additions and 1 deletions

View File

@ -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 <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/mathematics.h>
#include <libswscale/swscale.h>
}
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")