1 #[=======================================================================[.rst:
6 Find the native Ogg includes and library.
11 This module defines :prop_tgt:`IMPORTED` target ``Ogg::ogg``, if
17 This module defines the following variables:
21 OGG_INCLUDE_DIRS - where to find ogg.h, etc.
22 OGG_LIBRARIES - List of libraries when using ogg.
23 OGG_FOUND - True if ogg found.
27 OGG_VERSION_STRING - The version of ogg found (x.y.z)
32 A user may set ``OGG_ROOT`` to a ogg installation root to tell this
34 #]=======================================================================]
37 # Already in cache, be silent
38 set(OGG_FIND_QUIETLY TRUE)
41 find_package(PkgConfig QUIET)
42 pkg_check_modules(PC_OGG QUIET ogg)
44 set(OGG_VERSION_STRING ${PC_OGG_VERSION})
46 find_path(OGG_INCLUDE_DIR ogg/ogg.h
49 ${PC_OGG_INCLUDE_DIRS}
54 # MSVC built ogg may be named ogg_static.
55 # The provided project files name the library with the lib prefix.
56 find_library(OGG_LIBRARY
64 ${PC_OGG_LIBRARY_DIRS}
70 # Handle the QUIETLY and REQUIRED arguments and set OGG_FOUND
71 # to TRUE if all listed variables are TRUE.
72 include(FindPackageHandleStandardArgs)
73 find_package_handle_standard_args(Ogg
82 set(OGG_LIBRARIES ${OGG_LIBRARY})
83 set(OGG_INCLUDE_DIRS ${OGG_INCLUDE_DIR})
85 if(NOT TARGET Ogg::ogg)
86 add_library(Ogg::ogg UNKNOWN IMPORTED)
87 set_target_properties(Ogg::ogg PROPERTIES
88 INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIRS}"
89 IMPORTED_LOCATION "${OGG_LIBRARIES}"
94 mark_as_advanced(OGG_INCLUDE_DIR OGG_LIBRARY)