summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindOggVorbis.cmake
blob: a06ed17c466aa47160f6abf1a579499dba1c15c9 (plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# This file is part of Mixxx, Digital DJ'ing software.
# Copyright (C) 2001-2020 Mixxx Development Team
# Distributed under the GNU General Public Licence (GPL) version 2 or any later
# later version. See the LICENSE file for details.

#[=======================================================================[.rst:
FindOggVorbis
---------------

Finds the OggVorbis library.

Result Variables
^^^^^^^^^^^^^^^^

This will define the following variables:

``OggVorbis_FOUND``
  True if the system has the OggVorbis library.
``OggVorbis_INCLUDE_DIRS``
  Include directories needed to use OggVorbis.
``OggVorbis_LIBRARIES``
  Libraries needed to link to OggVorbis.

Cache Variables
^^^^^^^^^^^^^^^

The following cache variables may also be set:

``Ogg_INCLUDE_DIR``
  The directory containing ``ogg/ogg.h``.
``Ogg_LIBRARY``
  The path to the OggVorbis library.
``Vorbis_INCLUDE_DIR``
  The directory containing ``vorbis/vorbisfile.h``.
``Vorbis_LIBRARY``
  The path to the vorbis library.
``VorbisFile_LIBRARY``
  The path to the vorbisfile library.
``VorbisEnc_LIBRARY``
  The path to the vorbisenc library.
``Vorbis_LIBRARIES``
  Libraries needed to link to vorbis.

#]=======================================================================]
find_path(Ogg_INCLUDE_DIR NAMES ogg/ogg.h DOC "Ogg include directory")
mark_as_advanced(Ogg_INCLUDE_DIR)

find_library(Ogg_LIBRARY NAMES ogg DOC "Ogg library")
mark_as_advanced(Ogg_LIBRARY)

find_path(Vorbis_INCLUDE_DIR
  NAMES vorbis/vorbisfile.h
  DOC "Vorbis include directory"
)
mark_as_advanced(Vorbis_INCLUDE_DIR)

find_library(Vorbis_LIBRARY NAMES vorbis DOC "Vorbis library")
mark_as_advanced(Vorbis_LIBRARY)

find_library(VorbisFile_LIBRARY NAMES vorbisfile DOC "Vorbisfile library")
mark_as_advanced(VorbisFile_LIBRARY)

if(NOT MSVC)
  find_library(VorbisEnc_LIBRARY NAMES vorbisenc DOC "Vorbisenc library")
  mark_as_advanced(VorbisEnc_LIBRARY)
  set(Vorbis_LIBRARIES
    ${VorbisEnc_LIBRARY}
    ${VorbisFile_LIBRARY}
    ${Vorbis_LIBRARY}
  )
else()
  set(Vorbis_LIBRARIES ${VorbisFile_LIBRARY} ${Vorbis_LIBRARY})
endif()
mark_as_advanced(Vorbis_LIBRARIES)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
  OggVorbis
  REQUIRED_VARS
  Ogg_INCLUDE_DIR
  Vorbis_INCLUDE_DIR
  Ogg_LIBRARY
  Vorbis_LIBRARIES
)

if(OggVorbis_FOUND)
  set(OggVorbis_LIBRARIES ${Ogg_LIBRARY} ${Vorbis_LIBRARIES})
  set(OggVorbis_INCLUDE_DIRS ${Ogg_INCLUDE_DIR} ${Vorbis_INCLUDE_DIR})
endif()