aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/Modules/FindAVCodec.cmake
blob: 9667160f7bca936c3fb05945fd030a3e7ef59c93 (plain)
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
47
#[=======================================================================[.rst:
FindAVCodec
-----------

Find the FFmpeg avcodec library

Result variables
^^^^^^^^^^^^^^^^

This module will set the following variables if found:

``AVCODEC_INCLUDE_DIRS``
  where to find libavcodec/avcodec.h, etc.
``AVCODEC_LIBRARIES``
  the libraries to link against to use avcodec.
``AVCODEC_FOUND``
  TRUE if found

#]=======================================================================]

find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
  pkg_check_modules(PC_AVCodec QUIET libavcodec)
endif()

find_path(AVCodec_INCLUDE_DIR NAMES libavcodec/avcodec.h
  HINTS
    ${PC_AVCodec_INCLUDE_DIRS}
)
mark_as_advanced(AVCodec_INCLUDE_DIR)

find_library(AVCodec_LIBRARY NAMES avcodec
  HINTS
    ${PC_AVCodec_LIBRARY_DIRS}
)
mark_as_advanced(AVCodec_LIBRARY)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(AVCodec
  REQUIRED_VARS
    AVCodec_LIBRARY AVCodec_INCLUDE_DIR
)

if(AVCodec_FOUND)
  set(AVCODEC_INCLUDE_DIRS ${AVCodec_INCLUDE_DIR})
  set(AVCODEC_LIBRARIES ${AVCodec_LIBRARY})
endif()