]> git.lizzy.rs Git - minetest.git/blob - cmake/Modules/FindVorbis.cmake
Tile: Fix segfault caused by invalid PNG data
[minetest.git] / cmake / Modules / FindVorbis.cmake
1 # - Find vorbis
2 # Find the native vorbis includes and libraries
3 #
4 #  VORBIS_INCLUDE_DIR - where to find vorbis.h, etc.
5 #  OGG_INCLUDE_DIR    - where to find ogg/ogg.h, etc.
6 #  VORBIS_LIBRARIES   - List of libraries when using vorbis(file).
7 #  VORBIS_FOUND       - True if vorbis found.
8
9 if(NOT GP2XWIZ)
10     if(VORBIS_INCLUDE_DIR)
11         # Already in cache, be silent
12         set(VORBIS_FIND_QUIETLY TRUE)
13     endif(VORBIS_INCLUDE_DIR)
14     find_path(OGG_INCLUDE_DIR ogg/ogg.h)
15     find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
16     # MSVC built ogg/vorbis may be named ogg_static and vorbis_static
17     find_library(OGG_LIBRARY NAMES ogg ogg_static)
18     find_library(VORBIS_LIBRARY NAMES vorbis vorbis_static)
19     find_library(VORBISFILE_LIBRARY NAMES vorbisfile vorbisfile_static)
20     # Handle the QUIETLY and REQUIRED arguments and set VORBIS_FOUND
21     # to TRUE if all listed variables are TRUE.
22     include(FindPackageHandleStandardArgs)
23     find_package_handle_standard_args(Vorbis DEFAULT_MSG
24         OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR
25         OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY)
26 else(NOT GP2XWIZ)
27     find_path(VORBIS_INCLUDE_DIR tremor/ivorbisfile.h)
28     find_library(VORBIS_LIBRARY NAMES vorbis_dec)
29     find_package_handle_standard_args(Vorbis DEFAULT_MSG
30         VORBIS_INCLUDE_DIR VORBIS_LIBRARY)
31 endif(NOT GP2XWIZ)
32
33 if(VORBIS_FOUND)
34     if(NOT GP2XWIZ)
35         set(VORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY}
36             ${OGG_LIBRARY})
37     else(NOT GP2XWIZ)
38         set(VORBIS_LIBRARIES ${VORBIS_LIBRARY})
39     endif(NOT GP2XWIZ)
40 else(VORBIS_FOUND)
41     set(VORBIS_LIBRARIES)
42 endif(VORBIS_FOUND)
43
44 mark_as_advanced(OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR)
45 mark_as_advanced(OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY)