Debian Codegraph @

cmake/FindOgg.cmake

raw
1 # - Find ogg
2 # Find the native ogg includes and libraries
3 #
4 # Ogg_INCLUDE_DIRS - where to find ogg.h, etc.
5 # Ogg_LIBRARIES - List of libraries when using ogg.
6 # Ogg_FOUND - True if ogg found.
7
8 if(Ogg_INCLUDE_DIR)
9 # Already in cache, be silent
10 set(Ogg_FIND_QUIETLY TRUE)
11 endif()
12
13 find_package(PkgConfig QUIET)
14 pkg_check_modules(PC_Ogg QUIET ogg)
15
16 set(Ogg_VERSION ${PC_Ogg_VERSION})
17
18 find_path(Ogg_INCLUDE_DIR ogg/ogg.h
19 HINTS
20 ${PC_Ogg_INCLUDEDIR}
21 ${PC_Ogg_INCLUDE_DIRS}
22 ${Ogg_ROOT})
23 # MSVC built ogg may be named ogg_static.
24 # The provided project files name the library with the lib prefix.
25 find_library(Ogg_LIBRARY
26 NAMES
27 ogg
28 ogg_static
29 libogg
30 libogg_static
31 HINTS
32 ${PC_Ogg_LIBDIR}
33 ${PC_Ogg_LIBRARY_DIRS}
34 ${Ogg_ROOT})
35 # Handle the QUIETLY and REQUIRED arguments and set Ogg_FOUND
36 # to TRUE if all listed variables are TRUE.
37 include(FindPackageHandleStandardArgs)
38 find_package_handle_standard_args(Ogg
39 REQUIRED_VARS
40 Ogg_LIBRARY
41 Ogg_INCLUDE_DIR
42 VERSION_VAR
43 Ogg_VERSION)
44
45 if(Ogg_FOUND)
46 set(Ogg_LIBRARIES ${Ogg_LIBRARY})
47 set(Ogg_INCLUDE_DIRS ${Ogg_INCLUDE_DIR})
48
49 if(NOT TARGET Ogg::ogg)
50 add_library(Ogg::ogg UNKNOWN IMPORTED)
51 set_target_properties(Ogg::ogg PROPERTIES
52 INTERFACE_INCLUDE_DIRECTORIES "${Ogg_INCLUDE_DIR}"
53 IMPORTED_LOCATION "${Ogg_LIBRARY}")
54 endif()
55 endif()
56
57 mark_as_advanced(Ogg_INCLUDE_DIR Ogg_LIBRARY)