Updated SWH plugins and added missing hermes_filter plugin
[lmms/mlankhorst.git] / cmake / modules / FindOggVorbis.cmake
blob79a9ab406575a93ddb26b00652c933c200e04890
1 # - Try to find the OggVorbis libraries
2 # Once done this will define
4 #  OGGVORBIS_FOUND - system has OggVorbis
5 #  OGGVORBIS_VERSION - set either to 1 or 2
6 #  OGGVORBIS_INCLUDE_DIR - the OggVorbis include directory
7 #  OGGVORBIS_LIBRARIES - The libraries needed to use OggVorbis
8 #  OGG_LIBRARY         - The Ogg library
9 #  VORBIS_LIBRARY      - The Vorbis library
10 #  VORBISFILE_LIBRARY  - The VorbisFile library
11 #  VORBISENC_LIBRARY   - The VorbisEnc library
13 # Copyright (c) 2006, Richard Laerkaeng, <richard@goteborg.utfors.se>
15 # Redistribution and use is allowed according to the terms of the BSD license.
16 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
19 include (CheckLibraryExists)
21 find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
22 find_path(OGG_INCLUDE_DIR ogg/ogg.h)
24 find_library(OGG_LIBRARY NAMES ogg)
25 find_library(VORBIS_LIBRARY NAMES vorbis)
26 find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
27 find_library(VORBISENC_LIBRARY NAMES vorbisenc)
30 if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY)
31    set(OGGVORBIS_FOUND TRUE)
33    set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBISENC_LIBRARY})
35    set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES})
36    set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OGGVORBIS_LIBRARIES})
37    check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2)
38    set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_TMP})
40    if (HAVE_LIBVORBISENC2)
41       set (OGGVORBIS_VERSION 2)
42    else (HAVE_LIBVORBISENC2)
43       set (OGGVORBIS_VERSION 1)
44    endif (HAVE_LIBVORBISENC2)
46 else (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY)
47    set (OGGVORBIS_VERSION)
48    set(OGGVORBIS_FOUND FALSE)
49 endif (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY)
52 if (OGGVORBIS_FOUND)
53    if (NOT OggVorbis_FIND_QUIETLY)
54       message(STATUS "Found OggVorbis: ${OGGVORBIS_LIBRARIES}")
55    endif (NOT OggVorbis_FIND_QUIETLY)
56 else (OGGVORBIS_FOUND)
57    if (OggVorbis_FIND_REQUIRED)
58       message(FATAL_ERROR "Could NOT find OggVorbis libraries")
59    endif (OggVorbis_FIND_REQUIRED)
60    if (NOT OggVorbis_FIND_QUITELY)
61       message(STATUS "Could NOT find OggVorbis libraries")
62    endif (NOT OggVorbis_FIND_QUITELY)
63 endif (OGGVORBIS_FOUND)
65 #check_include_files(vorbis/vorbisfile.h HAVE_VORBISFILE_H)
66 #check_library_exists(ogg ogg_page_version "" HAVE_LIBOGG)
67 #check_library_exists(vorbis vorbis_info_init "" HAVE_LIBVORBIS)
68 #check_library_exists(vorbisfile ov_open "" HAVE_LIBVORBISFILE)
69 #check_library_exists(vorbisenc vorbis_info_clear "" HAVE_LIBVORBISENC)
70 #check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2)
72 #if (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC)
73 #    message(STATUS "Ogg/Vorbis found")
74 #    set (VORBIS_LIBS "-lvorbis -logg")
75 #    set (VORBISFILE_LIBS "-lvorbisfile")
76 #    set (VORBISENC_LIBS "-lvorbisenc")
77 #    set (OGGVORBIS_FOUND TRUE)
78 #    if (HAVE_LIBVORBISENC2)
79 #        set (HAVE_VORBIS 2)
80 #    else (HAVE_LIBVORBISENC2)
81 #        set (HAVE_VORBIS 1)
82 #    endif (HAVE_LIBVORBISENC2)
83 #else (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC)
84 #    message(STATUS "Ogg/Vorbis not found")
85 #endif (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC)