aboutsummaryrefslogtreecommitdiff
path: root/cmake/modules/FindVDPAU.cmake
blob: bb19a5439383ddacfc554d1c2a2bc4d4c212c161 (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
#.rst:
# FindVDPAU
# ---------
# Finds the VDPAU library
#
# This will define the following target:
#
#   ${APP_NAME_LC}::VDPAU   - The VDPAU library

if(NOT TARGET ${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME})
  find_package(PkgConfig)
  if(PKG_CONFIG_FOUND)
    pkg_check_modules(PC_VDPAU vdpau QUIET)
  endif()

  find_path(VDPAU_INCLUDE_DIR NAMES vdpau/vdpau.h vdpau/vdpau_x11.h
                              HINTS ${PC_VDPAU_INCLUDEDIR})
  find_library(VDPAU_LIBRARY NAMES vdpau
                             HINTS ${PC_VDPAU_LIBDIR})

  set(VDPAU_VERSION ${PC_VDPAU_VERSION})

  include(FindPackageHandleStandardArgs)
  find_package_handle_standard_args(VDPAU
                                    REQUIRED_VARS VDPAU_LIBRARY VDPAU_INCLUDE_DIR
                                    VERSION_VAR VDPAU_VERSION)

  if(VDPAU_FOUND)
    add_library(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} UNKNOWN IMPORTED)
    set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES
                                                                     IMPORTED_LOCATION "${VDPAU_LIBRARY}"
                                                                     INTERFACE_INCLUDE_DIRECTORIES "${VDPAU_INCLUDE_DIR}"
                                                                     INTERFACE_COMPILE_DEFINITIONS HAVE_LIBVDPAU)
  endif()
endif()