this repo has no description
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#
11# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
12# Modified for other libraries by Lasse Kärkkäinen <tronic>
13# Modified for Hedgewars by Stepik777
14# Modified for FFmpeg-example Tuukka Pasanen 2018
15#
16# Redistribution and use is allowed according to the terms of the New
17# BSD license.
18#
19
20include(FindPackageHandleStandardArgs)
21
22if(FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
23 # in cache already
24 set(FFMPEG_FOUND TRUE)
25else()
26 # use pkg-config to get the directories and then use these values
27 # in the FIND_PATH() and FIND_LIBRARY() calls
28 find_package(PkgConfig)
29 if(PKG_CONFIG_FOUND)
30 pkg_check_modules(_FFMPEG_AVCODEC libavcodec)
31 pkg_check_modules(_FFMPEG_AVFORMAT libavformat)
32 pkg_check_modules(_FFMPEG_AVUTIL libavutil)
33 endif()
34
35 find_path(FFMPEG_AVCODEC_INCLUDE_DIR
36 NAMES libavcodec/avcodec.h
37 PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS}
38 /usr/include
39 /usr/local/include
40 /opt/local/include
41 /sw/include
42 PATH_SUFFIXES ffmpeg libav)
43
44 find_library(FFMPEG_LIBAVCODEC
45 NAMES avcodec
46 PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS}
47 /usr/lib
48 /usr/local/lib
49 /opt/local/lib
50 /sw/lib)
51
52 find_library(FFMPEG_LIBAVFORMAT
53 NAMES avformat
54 PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS}
55 /usr/lib
56 /usr/local/lib
57 /opt/local/lib
58 /sw/lib)
59
60 find_library(FFMPEG_LIBAVUTIL
61 NAMES avutil
62 PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS}
63 /usr/lib
64 /usr/local/lib
65 /opt/local/lib
66 /sw/lib)
67
68 if(FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT)
69 set(FFMPEG_FOUND TRUE)
70 endif()
71
72 if(FFMPEG_FOUND)
73 set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR})
74 set(FFMPEG_LIBRARIES
75 ${FFMPEG_LIBAVCODEC}
76 ${FFMPEG_LIBAVFORMAT}
77 ${FFMPEG_LIBAVUTIL})
78 endif()
79
80 if(FFMPEG_FOUND)
81 if(NOT FFMPEG_FIND_QUIETLY)
82 message(STATUS
83 "Found FFMPEG or Libav: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}")
84 endif()
85 else()
86 message(FATAL_ERROR
87 "Could not find libavcodec or libavformat or libavutil")
88 endif()
89endif()
90
91find_package_handle_standard_args(FFmpeg
92FOUND_VAR FFMPEG_FOUND
93REQUIRED_VARS
94 FFMPEG_LIBRARIES
95 FFMPEG_INCLUDE_DIR
96VERSION_VAR FFMPEG_VERSION
97)