File: Findaom.cmake

package info (click to toggle)
libavif 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,956 kB
  • sloc: ansic: 29,303; cpp: 13,260; sh: 1,145; xml: 1,040; java: 307; makefile: 51
file content (56 lines) | stat: -rw-r--r-- 2,133 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# - Try to find aom
# Once done this will define
#
#  AOM_FOUND - system has aom
#  AOM_INCLUDE_DIR - the aom include directory
#  AOM_LIBRARIES - Link these to use aom
#
#=============================================================================
#  Copyright (c) 2020 Andreas Schneider <asn@cryptomilk.org>
#
#  Distributed under the OSI-approved BSD License (the "License");
#  see accompanying file Copyright.txt for details.
#
#  This software is distributed WITHOUT ANY WARRANTY; without even the
#  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#  See the License for more information.
#=============================================================================
#

find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
    pkg_check_modules(_AOM aom)
endif(PKG_CONFIG_FOUND)

find_path(AOM_INCLUDE_DIR NAMES aom/aom.h PATHS ${_AOM_INCLUDEDIR})

find_library(AOM_LIBRARY NAMES aom PATHS ${_AOM_LIBDIR})

set(AOM_LIBRARIES ${AOM_LIBRARIES} ${AOM_LIBRARY})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(aom REQUIRED_VARS AOM_LIBRARY AOM_LIBRARIES AOM_INCLUDE_DIR VERSION_VAR _AOM_VERSION)

# show the AOM_INCLUDE_DIR, AOM_LIBRARY and AOM_LIBRARIES variables only
# in the advanced view
mark_as_advanced(AOM_INCLUDE_DIR AOM_LIBRARY AOM_LIBRARIES)

if(AOM_LIBRARY)
    if("${AOM_LIBRARY}" MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")
        add_library(aom STATIC IMPORTED GLOBAL)

        set(_AOM_PC_LIBRARIES "${_AOM_STATIC_LIBRARIES}")
        # remove "aom" so we only have library dependencies
        list(REMOVE_ITEM _AOM_PC_LIBRARIES "aom")

        # Add absolute paths to libraries
        foreach(_lib ${_AOM_PC_LIBRARIES})
            find_library(_aom_dep_lib_${_lib} ${_lib} HINTS ${_AOM_STATIC_LIBRARY_DIRS})
            target_link_libraries(aom INTERFACE ${_aom_dep_lib_${_lib}})
        endforeach()
    else()
        add_library(aom SHARED IMPORTED GLOBAL)
    endif()
    set_target_properties(aom PROPERTIES IMPORTED_LOCATION "${AOM_LIBRARY}" IMPORTED_IMPLIB "${AOM_LIBRARY}")
    target_include_directories(aom INTERFACE ${AOM_INCLUDE_DIR})
endif()