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.
9 if (NOT FFmpeg_SEARCHED)
10 include(CheckLibraryExists)
12 set(FFmpeg_SEARCHED TRUE CACHE INTERNAL "")
13 set(FFmpeg_FOUND FALSE CACHE INTERNAL "")
15 pkg_check_modules(FFmpeg libffmpeg)
18 set(FFmpeg_LIBRARIES "")
19 foreach (library ffmpeg avcodec avformat avutil postproc swscale)
20 find_library( ${library}_LIBRARY ${library} )
21 if (${library}_LIBRARY)
22 pkg_check_modules(${library}_LIBRARY lib${library})
23 set(FFmpeg_CFLAGS "${FFmpeg_CFLAGS} ${${library}_LIBRARY_CFLAGS}")
24 set(FFmpeg_LIBRARIES "${library};${FFmpeg_LIBRARIES}")
25 set(FFmpeg_FOUND TRUE CACHE INTERNAL "")
26 endif (${library}_LIBRARY)
28 foreach (library a52 faac lame z png mp3lame twolame)
29 find_library( ${library}_LIBRARY ${library} )
30 if (${library}_LIBRARY)
31 pkg_check_modules(${library}_LIBRARY lib${library})
32 set(FFmpeg_CFLAGS "${FFmpeg_CFLAGS} ${${library}_LIBRARY_CFLAGS}")
33 set(FFmpeg_LIBRARIES "${library};${FFmpeg_LIBRARIES}")
34 endif (${library}_LIBRARY)
36 set(FFmpeg_LIBRARIES "${FFmpeg_LIBRARIES}" CACHE INTERNAL STRING)
37 endif (NOT FFmpeg_FOUND)
40 if (NOT FFmpeg_FIND_QUIETLY)
41 message(STATUS "Found FFmpeg in: ${FFmpeg_LIBRARIES}")
42 endif (NOT FFmpeg_FIND_QUIETLY)
44 if (FFmpeg_FIND_REQUIRED)
45 message(FATAL_ERROR "Could not find the library containing FFmpeg")
46 endif (FFmpeg_FIND_REQUIRED)
49 mark_as_advanced(FFmpeg_LIBRARIES)
50 endif(NOT FFmpeg_SEARCHED)