File: FindAVCodec.cmake

package info (click to toggle)
performous 1.1%2Bgit20181118-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 11,736 kB
  • sloc: cpp: 30,008; ansic: 2,751; sh: 801; xml: 464; python: 374; makefile: 36
file content (46 lines) | stat: -rw-r--r-- 1,374 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# - Try to find FFMPEG libavcodec
# Once done, this will define
#
#  AVCodec_FOUND - the library is available
#  AVCodec_INCLUDE_DIRS - the include directories
#  AVCodec_LIBRARIES - the libraries
#  AVCodec_INCLUDE - the file to #include (may be used in config.h)
#
# See documentation on how to write CMake scripts at
# http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries

include(LibFindMacros)

libfind_package(AVCodec AVUtil)

# TODO: pkg-config extra deps: libraw1394 theora vorbisenc

libfind_pkg_check_modules(AVCodec_PKGCONF libavcodec)

find_path(AVCodec_INCLUDE_DIR
  NAMES libavcodec/avcodec.h ffmpeg/avcodec.h avcodec.h
  HINTS ${AVCodec_PKGCONF_INCLUDE_DIRS}
  PATH_SUFFIXES ffmpeg
)

if(AVCodec_INCLUDE_DIR)
  foreach(suffix libavcodec/ ffmpeg/ "")
    if(NOT AVCodec_INCLUDE)
      if(EXISTS "${AVCodec_INCLUDE_DIR}/${suffix}avcodec.h")
        set(AVCodec_INCLUDE "${suffix}avcodec.h" CACHE INTERNAL "")
      endif(EXISTS "${AVCodec_INCLUDE_DIR}/${suffix}avcodec.h")
    endif(NOT AVCodec_INCLUDE)
  endforeach(suffix)

  if(NOT AVCodec_INCLUDE)
    message(FATAL_ERROR "Found avcodec.h include dir, but not the header file. Perhaps you need to clear CMake cache?")
  endif(NOT AVCodec_INCLUDE)
endif(AVCodec_INCLUDE_DIR)

find_library(AVCodec_LIBRARY
  NAMES libavcodec.dll.a avcodec
  HINTS ${AVCodec_PKGCONF_LIBRARY_DIRS}
)

libfind_process(AVCodec)