|
| 1 | +# Copyright (C) 2001-2020 Mixxx Development Team |
| 2 | +# Distributed under the GNU General Public Licence (GPL) version 2 or any later |
| 3 | +# later version. See the LICENSE.txt file for details. |
| 4 | + |
| 5 | +#[=======================================================================[.rst: |
| 6 | +FindVorbis |
| 7 | +---------- |
| 8 | +
|
| 9 | +Finds the Vorbis library. |
| 10 | +
|
| 11 | +Result Variables |
| 12 | +^^^^^^^^^^^^^^^^ |
| 13 | +
|
| 14 | +This will define the following variables: |
| 15 | +
|
| 16 | +``Vorbis_FOUND`` |
| 17 | + True if the system has the OggVorbis library. |
| 18 | +``Vorbis_INCLUDE_DIRS`` |
| 19 | + Include directories needed to use OggVorbis. |
| 20 | +``Vorbis_LIBRARIES`` |
| 21 | + Libraries needed to link to OggVorbis. |
| 22 | +
|
| 23 | +Cache Variables |
| 24 | +^^^^^^^^^^^^^^^ |
| 25 | +
|
| 26 | +The following cache variables may also be set: |
| 27 | +
|
| 28 | +``Vorbis_vorbis_INCLUDE_DIR`` |
| 29 | + The directory containing ``vorbis/vorbis.h``. |
| 30 | +``Vorbis_vorbisenc_INCLUDE_DIR`` |
| 31 | + The directory containing ``vorbis/vorbisenc.h``. |
| 32 | +``Vorbis_vorbisfile_INCLUDE_DIR`` |
| 33 | + The directory containing ``vorbis/vorbisfile.h``. |
| 34 | +``Vorbis_vorbis_LIBRARY`` |
| 35 | + The path to the vorbis library. |
| 36 | +``Vorbis_vorbisenc_LIBRARY`` |
| 37 | + The path to the vorbisenc library. |
| 38 | +``Vorbis_vorbisfile_LIBRARY`` |
| 39 | + The path to the vorbisfile library. |
| 40 | +``Vorbis_LIBRARIES`` |
| 41 | + Libraries needed to link to vorbis. |
| 42 | +
|
| 43 | +#]=======================================================================] |
| 44 | + |
| 45 | +find_path(Vorbis_vorbis_INCLUDE_DIR |
| 46 | + NAMES vorbis/codec.h |
| 47 | + DOC "Vorbis include directory" |
| 48 | +) |
| 49 | +mark_as_advanced(Vorbis_vorbis_INCLUDE_DIR) |
| 50 | + |
| 51 | +find_path(Vorbis_vorbisenc_INCLUDE_DIR |
| 52 | + NAMES vorbis/vorbisenc.h |
| 53 | + DOC "Vorbisenc include directory" |
| 54 | +) |
| 55 | +mark_as_advanced(Vorbis_vorbisenc_INCLUDE_DIR) |
| 56 | + |
| 57 | +find_path(Vorbis_vorbisfile_INCLUDE_DIR |
| 58 | + NAMES vorbis/vorbisfile.h |
| 59 | + DOC "Vorbisfile include directory" |
| 60 | +) |
| 61 | +mark_as_advanced(Vorbis_vorbisfile_INCLUDE_DIR) |
| 62 | + |
| 63 | +find_library(Vorbis_vorbis_LIBRARY |
| 64 | + NAMES vorbis |
| 65 | + DOC "Vorbis library") |
| 66 | +mark_as_advanced(Vorbis_vorbis_LIBRARY) |
| 67 | + |
| 68 | +find_library(Vorbis_vorbisenc_LIBRARY |
| 69 | + NAMES vorbisenc |
| 70 | + DOC "Vorbisenc library") |
| 71 | +mark_as_advanced(Vorbis_vorbisenc_LIBRARY) |
| 72 | + |
| 73 | +find_library(Vorbis_vorbisfile_LIBRARY |
| 74 | + NAMES vorbisfile |
| 75 | + DOC "Vorbisfile library") |
| 76 | +mark_as_advanced(Vorbis_vorbisfile_LIBRARY) |
| 77 | + |
| 78 | +if(NOT Vorbis_FIND_COMPONENTS) |
| 79 | + set(Vorbis_FIND_COMPONENTS "vorbis;vorbisenc;vorbisfile") |
| 80 | +endif() |
| 81 | + |
| 82 | +foreach(component ${Vorbis_FIND_COMPONENTS}) |
| 83 | + if(Vorbis_${component}_INCLUDE_DIR AND Vorbis_${component}_LIBRARY) |
| 84 | + set(Vorbis_${component}_FOUND TRUE) |
| 85 | + if(NOT TARGET Vorbis::${component}) |
| 86 | + add_library(Vorbis::${component} UNKNOWN IMPORTED) |
| 87 | + set_target_properties(Vorbis::${component} |
| 88 | + PROPERTIES |
| 89 | + IMPORTED_LOCATION "${Vorbis_${component}_LIBRARY}" |
| 90 | + INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_${component}_INCLUDE_DIR}" |
| 91 | + ) |
| 92 | + endif() |
| 93 | + else() |
| 94 | + set(Vorbis_${component}_FOUND FALSE) |
| 95 | + endif() |
| 96 | +endforeach() |
| 97 | + |
| 98 | +include(FindPackageHandleStandardArgs) |
| 99 | +find_package_handle_standard_args(Vorbis |
| 100 | + REQUIRED_VARS Vorbis_vorbis_INCLUDE_DIR Vorbis_vorbis_LIBRARY |
| 101 | + HANDLE_COMPONENTS |
| 102 | +) |
0 commit comments