1 # - Find library containing FFmpeg()
2 # The following variables are set if FFmpeg is found. If FFmpeg is not
3 # found, FFmpeg_FOUND is set to false.
4 # FFmpeg_FOUND - System has FFmpeg.
5 # FFmpeg_LIBRARIES - Link these to use FFmpeg.
6 # FFmpeg_CFLAGS - Link these to use FFmpeg.
8 if (NOT FFmpeg_SEARCHED)
9 include(CheckLibraryExists)
11 set(FFmpeg_SEARCHED TRUE CACHE INTERNAL "")
12 set(FFmpeg_FOUND FALSE CACHE INTERNAL "")
14 pkg_check_modules(FFmpeg libffmpeg)
17 set(FFmpeg_LIBRARIES "")
18 foreach (library ffmpeg avcodec avformat avutil postproc swscale)
19 find_library( ${library}_LIBRARY ${library} )
20 if (${library}_LIBRARY)
21 pkg_check_modules(${library}_LIBRARY lib${library})
22 set(FFmpeg_LIBRARIES "${library};${FFmpeg_LIBRARIES}")
24 if (${library}_LIBRARY_CFLAGS)
25 set(FFmpeg_CFLAGS ${FFmpeg_CFLAGS} ${${library}_LIBRARY_CFLAGS})
26 endif (${library}_LIBRARY_CFLAGS)
27 set(FFmpeg_FOUND TRUE CACHE INTERNAL "")
28 endif (${library}_LIBRARY)
30 foreach (library a52 faac lame z png mp3lame twolame)
31 find_library( ${library}_LIBRARY ${library} )
32 if (${library}_LIBRARY)
33 pkg_check_modules(${library}_LIBRARY lib${library})
34 set(FFmpeg_LIBRARIES "${library};${FFmpeg_LIBRARIES}")
36 if (${library}_LIBRARY_CFLAGS)
37 set(FFmpeg_CFLAGS ${FFmpeg_CFLAGS} ${${library}_LIBRARY_CFLAGS})
38 endif (${library}_LIBRARY_CFLAGS)
39 endif (${library}_LIBRARY)
41 set(FFmpeg_LIBRARIES "${FFmpeg_LIBRARIES}" CACHE INTERNAL STRING)
42 endif (NOT FFmpeg_FOUND)
45 if (NOT FFmpeg_FIND_QUIETLY)
46 message(STATUS "Found FFmpeg in: ${FFmpeg_LIBRARIES}")
47 endif (NOT FFmpeg_FIND_QUIETLY)
49 if (FFmpeg_FIND_REQUIRED)
50 message(FATAL_ERROR "Could not find the library containing FFmpeg")
51 endif (FFmpeg_FIND_REQUIRED)
54 mark_as_advanced(FFmpeg_LIBRARIES)
55 endif(NOT FFmpeg_SEARCHED)