| 1 |
#[=======================================================================[.rst: |
| 2 |
FindVorbis |
| 3 |
---------- |
| 4 |
|
| 5 |
Finds the native vorbis, vorbisenc amd vorbisfile includes and libraries. |
| 6 |
|
| 7 |
Imported Targets |
| 8 |
^^^^^^^^^^^^^^^^ |
| 9 |
|
| 10 |
This module provides the following imported targets, if found: |
| 11 |
|
| 12 |
``Vorbis::vorbis`` |
| 13 |
The Vorbis library |
| 14 |
``Vorbis::vorbisenc`` |
| 15 |
The VorbisEnc library |
| 16 |
``Vorbis::vorbisfile`` |
| 17 |
The VorbisFile library |
| 18 |
|
| 19 |
Result Variables |
| 20 |
^^^^^^^^^^^^^^^^ |
| 21 |
|
| 22 |
This will define the following variables: |
| 23 |
|
| 24 |
``Vorbis_Vorbis_INCLUDE_DIRS`` |
| 25 |
List of include directories when using vorbis. |
| 26 |
``Vorbis_Enc_INCLUDE_DIRS`` |
| 27 |
List of include directories when using vorbisenc. |
| 28 |
``Vorbis_File_INCLUDE_DIRS`` |
| 29 |
List of include directories when using vorbisfile. |
| 30 |
``Vorbis_Vorbis_LIBRARIES`` |
| 31 |
List of libraries when using vorbis. |
| 32 |
``Vorbis_Enc_LIBRARIES`` |
| 33 |
List of libraries when using vorbisenc. |
| 34 |
``Vorbis_File_LIBRARIES`` |
| 35 |
List of libraries when using vorbisfile. |
| 36 |
``Vorbis_FOUND`` |
| 37 |
True if vorbis and requested components found. |
| 38 |
``Vorbis_Vorbis_FOUND`` |
| 39 |
True if vorbis found. |
| 40 |
``Vorbis_Enc_FOUND`` |
| 41 |
True if vorbisenc found. |
| 42 |
``Vorbis_Enc_FOUND`` |
| 43 |
True if vorbisfile found. |
| 44 |
|
| 45 |
Cache variables |
| 46 |
^^^^^^^^^^^^^^^ |
| 47 |
|
| 48 |
The following cache variables may also be set: |
| 49 |
|
| 50 |
``Vorbis_Vorbis_INCLUDE_DIR`` |
| 51 |
The directory containing ``vorbis/vorbis.h``. |
| 52 |
``Vorbis_Enc_INCLUDE_DIR`` |
| 53 |
The directory containing ``vorbis/vorbisenc.h``. |
| 54 |
``Vorbis_File_INCLUDE_DIR`` |
| 55 |
The directory containing ``vorbis/vorbisenc.h``. |
| 56 |
``Vorbis_Vorbis_LIBRARY`` |
| 57 |
The path to the vorbis library. |
| 58 |
``Vorbis_Enc_LIBRARY`` |
| 59 |
The path to the vorbisenc library. |
| 60 |
``Vorbis_File_LIBRARY`` |
| 61 |
The path to the vorbisfile library. |
| 62 |
|
| 63 |
Hints |
| 64 |
^^^^^ |
| 65 |
|
| 66 |
A user may set ``Vorbis_ROOT`` to a vorbis installation root to tell this module where to look. |
| 67 |
|
| 68 |
#]=======================================================================] |
| 69 |
|
| 70 |
if (Vorbis_Vorbis_INCLUDE_DIR) |
| 71 |
# Already in cache, be silent |
| 72 |
set (Vorbis_FIND_QUIETLY TRUE) |
| 73 |
endif () |
| 74 |
|
| 75 |
set (Vorbis_Vorbis_FIND_QUIETLY TRUE) |
| 76 |
set (Vorbis_Enc_FIND_QUIETLY TRUE) |
| 77 |
set (Vorbis_File_FIND_QUIETLY TRUE) |
| 78 |
|
| 79 |
find_package (Ogg QUIET) |
| 80 |
|
| 81 |
find_package (PkgConfig QUIET) |
| 82 |
pkg_check_modules (PC_Vorbis_Vorbis QUIET vorbis) |
| 83 |
pkg_check_modules (PC_Vorbis_Enc QUIET vorbisenc) |
| 84 |
pkg_check_modules (PC_Vorbis_File QUIET vorbisfile) |
| 85 |
|
| 86 |
set (Vorbis_VERSION ${PC_Vorbis_Vorbis_VERSION}) |
| 87 |
|
| 88 |
find_path (Vorbis_Vorbis_INCLUDE_DIR vorbis/codec.h |
| 89 |
HINTS |
| 90 |
${PC_Vorbis_Vorbis_INCLUDEDIR} |
| 91 |
${PC_Vorbis_Vorbis_INCLUDE_DIRS} |
| 92 |
${Vorbis_ROOT} |
| 93 |
) |
| 94 |
|
| 95 |
find_path (Vorbis_Enc_INCLUDE_DIR vorbis/vorbisenc.h |
| 96 |
HINTS |
| 97 |
${PC_Vorbis_Enc_INCLUDEDIR} |
| 98 |
${PC_Vorbis_Enc_INCLUDE_DIRS} |
| 99 |
${Vorbis_ROOT} |
| 100 |
) |
| 101 |
|
| 102 |
find_path (Vorbis_File_INCLUDE_DIR vorbis/vorbisfile.h |
| 103 |
HINTS |
| 104 |
${PC_Vorbis_File_INCLUDEDIR} |
| 105 |
${PC_Vorbis_File_INCLUDE_DIRS} |
| 106 |
${Vorbis_ROOT} |
| 107 |
) |
| 108 |
|
| 109 |
find_library (Vorbis_Vorbis_LIBRARY |
| 110 |
NAMES |
| 111 |
vorbis |
| 112 |
vorbis_static |
| 113 |
libvorbis |
| 114 |
libvorbis_static |
| 115 |
HINTS |
| 116 |
${PC_Vorbis_Vorbis_LIBDIR} |
| 117 |
${PC_Vorbis_Vorbis_LIBRARY_DIRS} |
| 118 |
${Vorbis_ROOT} |
| 119 |
) |
| 120 |
|
| 121 |
find_library (Vorbis_Enc_LIBRARY |
| 122 |
NAMES |
| 123 |
vorbisenc |
| 124 |
vorbisenc_static |
| 125 |
libvorbisenc |
| 126 |
libvorbisenc_static |
| 127 |
HINTS |
| 128 |
${PC_Vorbis_Enc_LIBDIR} |
| 129 |
${PC_Vorbis_Enc_LIBRARY_DIRS} |
| 130 |
${Vorbis_ROOT} |
| 131 |
) |
| 132 |
|
| 133 |
find_library (Vorbis_File_LIBRARY |
| 134 |
NAMES |
| 135 |
vorbisfile |
| 136 |
vorbisfile_static |
| 137 |
libvorbisfile |
| 138 |
libvorbisfile_static |
| 139 |
HINTS |
| 140 |
${PC_Vorbis_File_LIBDIR} |
| 141 |
${PC_Vorbis_File_LIBRARY_DIRS} |
| 142 |
${Vorbis_ROOT} |
| 143 |
) |
| 144 |
|
| 145 |
include (FindPackageHandleStandardArgs) |
| 146 |
|
| 147 |
if (Vorbis_Vorbis_LIBRARY AND Vorbis_Vorbis_INCLUDE_DIR AND Ogg_FOUND) |
| 148 |
set (Vorbis_Vorbis_FOUND TRUE) |
| 149 |
endif () |
| 150 |
|
| 151 |
if (Vorbis_Enc_LIBRARY AND Vorbis_Enc_INCLUDE_DIR AND Vorbis_Vorbis_FOUND) |
| 152 |
set (Vorbis_Enc_FOUND TRUE) |
| 153 |
endif () |
| 154 |
|
| 155 |
if (Vorbis_Vorbis_FOUND AND Vorbis_File_LIBRARY AND Vorbis_File_INCLUDE_DIR) |
| 156 |
set (Vorbis_File_FOUND TRUE) |
| 157 |
endif () |
| 158 |
|
| 159 |
find_package_handle_standard_args (Vorbis |
| 160 |
REQUIRED_VARS |
| 161 |
Vorbis_Vorbis_LIBRARY |
| 162 |
Vorbis_Vorbis_INCLUDE_DIR |
| 163 |
Ogg_FOUND |
| 164 |
HANDLE_COMPONENTS |
| 165 |
VERSION_VAR Vorbis_VERSION) |
| 166 |
|
| 167 |
|
| 168 |
if (Vorbis_Vorbis_FOUND) |
| 169 |
set (Vorbis_Vorbis_INCLUDE_DIRS ${VORBIS_INCLUDE_DIR}) |
| 170 |
set (Vorbis_Vorbis_LIBRARIES ${VORBIS_LIBRARY} ${OGG_LIBRARIES}) |
| 171 |
if (NOT TARGET Vorbis::vorbis) |
| 172 |
add_library (Vorbis::vorbis UNKNOWN IMPORTED) |
| 173 |
set_target_properties (Vorbis::vorbis PROPERTIES |
| 174 |
INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_Vorbis_INCLUDE_DIR}" |
| 175 |
IMPORTED_LOCATION "${Vorbis_Vorbis_LIBRARY}" |
| 176 |
INTERFACE_LINK_LIBRARIES Ogg::ogg |
| 177 |
) |
| 178 |
endif () |
| 179 |
|
| 180 |
if (Vorbis_Enc_FOUND) |
| 181 |
set (Vorbis_Enc_INCLUDE_DIRS ${Vorbis_Enc_INCLUDE_DIR}) |
| 182 |
set (Vorbis_Enc_LIBRARIES ${Vorbis_Enc_LIBRARY} ${Vorbis_Enc_LIBRARIES}) |
| 183 |
if (NOT TARGET Vorbis::vorbisenc) |
| 184 |
add_library (Vorbis::vorbisenc UNKNOWN IMPORTED) |
| 185 |
set_target_properties (Vorbis::vorbisenc PROPERTIES |
| 186 |
INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_Enc_INCLUDE_DIR}" |
| 187 |
IMPORTED_LOCATION "${Vorbis_Enc_LIBRARY}" |
| 188 |
INTERFACE_LINK_LIBRARIES Vorbis::vorbis |
| 189 |
) |
| 190 |
endif () |
| 191 |
endif () |
| 192 |
|
| 193 |
if (Vorbis_File_FOUND) |
| 194 |
set (Vorbis_File_INCLUDE_DIRS ${Vorbis_File_INCLUDE_DIR}) |
| 195 |
set (Vorbis_File_LIBRARIES ${Vorbis_File_LIBRARY} ${Vorbis_File_LIBRARIES}) |
| 196 |
if (NOT TARGET Vorbis::vorbisfile) |
| 197 |
add_library (Vorbis::vorbisfile UNKNOWN IMPORTED) |
| 198 |
set_target_properties (Vorbis::vorbisfile PROPERTIES |
| 199 |
INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_File_INCLUDE_DIR}" |
| 200 |
IMPORTED_LOCATION "${Vorbis_File_LIBRARY}" |
| 201 |
INTERFACE_LINK_LIBRARIES Vorbis::vorbis |
| 202 |
) |
| 203 |
endif () |
| 204 |
endif () |
| 205 |
|
| 206 |
endif () |
| 207 |
|
| 208 |
mark_as_advanced (Vorbis_Vorbis_INCLUDE_DIR Vorbis_Vorbis_LIBRARY) |
| 209 |
mark_as_advanced (Vorbis_Enc_INCLUDE_DIR Vorbis_Enc_LIBRARY) |
| 210 |
mark_as_advanced (Vorbis_File_INCLUDE_DIR Vorbis_File_LIBRARY) |