this repo has no description
at master 88 lines 2.7 kB view raw
1# - Try to find ffmpeg libraries (libavcodec, libavformat and libavutil) 2# Once done this will define 3# 4# FFMPEG_FOUND - system has ffmpeg or libav 5# FFMPEG_INCLUDE_DIR - the ffmpeg include directory 6# FFMPEG_LIBRARIES - Link these to use ffmpeg 7# FFMPEG_LIBAVCODEC 8# FFMPEG_LIBAVFORMAT 9# FFMPEG_LIBAVUTIL 10# FFMPEG_LIBSWSCALE 11# 12# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org> 13# Modified for other libraries by Lasse Kärkkäinen <tronic> 14# Modified for Hedgewars by Stepik777 15# Modified for SDL_gpu by Jonathan Dearborn 16# 17# Redistribution and use is allowed according to the terms of the New 18# BSD license. 19# 20 21if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) 22 # in cache already 23 set(FFMPEG_FOUND TRUE) 24else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) 25 # use pkg-config to get the directories and then use these values 26 # in the FIND_PATH() and FIND_LIBRARY() calls 27 find_package(PkgConfig) 28 if (PKG_CONFIG_FOUND) 29 pkg_check_modules(_FFMPEG_AVCODEC libavcodec) 30 pkg_check_modules(_FFMPEG_AVFORMAT libavformat) 31 pkg_check_modules(_FFMPEG_AVUTIL libavutil) 32 pkg_check_modules(_FFMPEG_SWSCALE libswscale) 33 endif (PKG_CONFIG_FOUND) 34 35 find_path(FFMPEG_AVCODEC_INCLUDE_DIR 36 NAMES libavcodec/avcodec.h 37 PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} /usr/include /usr/local/include /opt/local/include /sw/include 38 PATH_SUFFIXES ffmpeg libav 39 ) 40 41 find_library(FFMPEG_LIBAVCODEC 42 NAMES avcodec 43 PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib 44 ) 45 46 find_library(FFMPEG_LIBAVFORMAT 47 NAMES avformat 48 PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib 49 ) 50 51 find_library(FFMPEG_LIBAVUTIL 52 NAMES avutil 53 PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib 54 ) 55 56 find_library(FFMPEG_LIBSWSCALE 57 NAMES swscale 58 PATHS ${_FFMPEG_SWSCALE_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib 59 ) 60 61 if (FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT) 62 set(FFMPEG_FOUND TRUE) 63 endif() 64 65 if (FFMPEG_FOUND) 66 set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR}) 67 68 set(FFMPEG_LIBRARIES 69 ${FFMPEG_LIBAVCODEC} 70 ${FFMPEG_LIBAVFORMAT} 71 ${FFMPEG_LIBAVUTIL} 72 ${FFMPEG_LIBSWSCALE} 73 ) 74 75 endif (FFMPEG_FOUND) 76 77 if (FFMPEG_FOUND) 78 if (NOT FFMPEG_FIND_QUIETLY) 79 message(STATUS "Found FFMPEG or Libav: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}") 80 endif (NOT FFMPEG_FIND_QUIETLY) 81 else (FFMPEG_FOUND) 82 if (FFMPEG_FIND_REQUIRED) 83 message(FATAL_ERROR "Could not find libavcodec or libavformat or libavutil") 84 endif (FFMPEG_FIND_REQUIRED) 85 endif (FFMPEG_FOUND) 86 87endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) 88