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
8if(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    find_library(OGG_LIBRARY NAMES ogg)
16    find_library(VORBIS_LIBRARY NAMES vorbis)
17    find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
18    # Handle the QUIETLY and REQUIRED arguments and set VORBIS_FOUND
19    # to TRUE if all listed variables are TRUE.
20    include(FindPackageHandleStandardArgs)
21    find_package_handle_standard_args(VORBIS DEFAULT_MSG
22        OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR
23        OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY)
24else(NOT GP2XWIZ)
25    find_path(VORBIS_INCLUDE_DIR tremor/ivorbisfile.h)
26    find_library(VORBIS_LIBRARY NAMES vorbis_dec)
27    find_package_handle_standard_args(VORBIS DEFAULT_MSG
28        VORBIS_INCLUDE_DIR VORBIS_LIBRARY)
29endif(NOT GP2XWIZ)
30
31if(VORBIS_FOUND)
32  if(NOT GP2XWIZ)
33     set(VORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY}
34           ${OGG_LIBRARY})
35  else(NOT GP2XWIZ)
36     set(VORBIS_LIBRARIES ${VORBIS_LIBRARY})
37  endif(NOT GP2XWIZ)
38else(VORBIS_FOUND)
39  set(VORBIS_LIBRARIES)
40endif(VORBIS_FOUND)
41
42mark_as_advanced(OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR)
43mark_as_advanced(OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY)
44
45