1# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2# file Copyright.txt or https://cmake.org/licensing for details.
3
4#[=======================================================================[.rst:
5FindMPEG2
6---------
7
8Find the native MPEG2 includes and library
9
10This module defines
11
12::
13
14  MPEG2_INCLUDE_DIR, path to mpeg2dec/mpeg2.h, etc.
15  MPEG2_LIBRARIES, the libraries required to use MPEG2.
16  MPEG2_FOUND, If false, do not try to use MPEG2.
17
18also defined, but not for general use are
19
20::
21
22  MPEG2_mpeg2_LIBRARY, where to find the MPEG2 library.
23  MPEG2_vo_LIBRARY, where to find the vo library.
24#]=======================================================================]
25
26find_path(MPEG2_INCLUDE_DIR
27  NAMES mpeg2.h mpeg2dec/mpeg2.h)
28
29find_library(MPEG2_mpeg2_LIBRARY mpeg2)
30
31find_library(MPEG2_vo_LIBRARY vo)
32
33include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
34FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG2 DEFAULT_MSG MPEG2_mpeg2_LIBRARY MPEG2_INCLUDE_DIR)
35
36if(MPEG2_FOUND)
37  set(MPEG2_LIBRARIES ${MPEG2_mpeg2_LIBRARY})
38  if(MPEG2_vo_LIBRARY)
39    list(APPEND MPEG2_LIBRARIES ${MPEG2_vo_LIBRARY})
40  endif()
41
42  #some native mpeg2 installations will depend
43  #on libSDL, if found, add it in.
44  find_package(SDL)
45  if(SDL_FOUND)
46    set( MPEG2_LIBRARIES ${MPEG2_LIBRARIES} ${SDL_LIBRARY})
47  endif()
48endif()
49
50mark_as_advanced(MPEG2_INCLUDE_DIR MPEG2_mpeg2_LIBRARY MPEG2_vo_LIBRARY)
51