]> git.jsancho.org Git - lugaru.git/blob - cmake/FindVorbis.cmake
e0cb2c1ac289d506ed054d6ef2f1ecb45a4be30a
[lugaru.git] / cmake / 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 #  VORBIS_LIBRARIES   - List of libraries when using vorbis(file).
6 #  VORBIS_FOUND       - True if vorbis found.
7
8 if(NOT GP2XWIZ)
9     if(VORBIS_INCLUDE_DIR)
10         # Already in cache, be silent
11         set(VORBIS_FIND_QUIETLY TRUE)
12     endif(VORBIS_INCLUDE_DIR)
13     find_path(OGG_INCLUDE_DIR ogg/ogg.h)
14     find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
15     # MSVC built ogg/vorbis may be named ogg_static and vorbis_static
16     find_library(OGG_LIBRARY NAMES ogg ogg_static)
17     find_library(VORBIS_LIBRARY NAMES vorbis vorbis_static)
18     find_library(VORBISFILE_LIBRARY NAMES vorbisfile vorbisfile_static)
19     # Handle the QUIETLY and REQUIRED arguments and set VORBIS_FOUND
20     # to TRUE if all listed variables are TRUE.
21     include(FindPackageHandleStandardArgs)
22     find_package_handle_standard_args(VORBIS DEFAULT_MSG
23         OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR
24         OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY)
25 else(NOT GP2XWIZ)
26     find_path(VORBIS_INCLUDE_DIR tremor/ivorbisfile.h)
27     find_library(VORBIS_LIBRARY NAMES vorbis_dec)
28     find_package_handle_standard_args(VORBIS DEFAULT_MSG
29         VORBIS_INCLUDE_DIR VORBIS_LIBRARY)
30 endif(NOT GP2XWIZ)
31     
32 if(VORBIS_FOUND)
33   if(NOT GP2XWIZ)
34      set(VORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY}
35            ${OGG_LIBRARY})
36   else(NOT GP2XWIZ)
37      set(VORBIS_LIBRARIES ${VORBIS_LIBRARY})
38   endif(NOT GP2XWIZ)
39 else(VORBIS_FOUND)
40   set(VORBIS_LIBRARIES)
41 endif(VORBIS_FOUND)
42
43 mark_as_advanced(OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR)
44 mark_as_advanced(OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY)
45