File: FindHEIF.cmake

package info (click to toggle)
kodi-imagedecoder-heif 1.3.0%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 140 kB
  • sloc: cpp: 83; makefile: 10
file content (42 lines) | stat: -rw-r--r-- 1,149 bytes parent folder | download | duplicates (3)
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
#.rst:
# FindHEIF
# --------
# Finds the HEIF library
#
# This will will define the following variables::
#
# HEIF_FOUND - system has heif
# HEIF_INCLUDE_DIRS - the heif include directory
# HEIF_LIBRARIES - the heif libraries
#
# and the following imported targets::
#
#   HEIF::HEIF - The HEIF library

if(PKG_CONFIG_FOUND)
  pkg_check_modules(PC_HEIF libheif QUIET)
endif()

find_path(HEIF_INCLUDE_DIR NAMES libheif/heif.h
                           PATHS ${PC_HEIF_INCLUDEDIR})
find_library(HEIF_LIBRARY NAMES heif libheif
                          PATHS ${PC_HEIF_LIBDIR})

set(HEIF_VERSION ${PC_HEIF_VERSION})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HEIF
                                  REQUIRED_VARS HEIF_LIBRARY HEIF_INCLUDE_DIR
                                  VERSION_VAR HEIF_VERSION)

if(HEIF_FOUND)
  set(HEIF_LIBRARIES ${HEIF_LIBRARY})

  if(NOT TARGET HEIF::HEIF)
    add_library(HEIF::HEIF UNKNOWN IMPORTED)
    set_target_properties(HEIF::HEIF PROPERTIES
                                     IMPORTED_LOCATION "${HEIF_LIBRARY}")
  endif()
endif()

mark_as_advanced(HEIF_INCLUDE_DIR HEIF_LIBRARY)