Warning, /multimedia/k3b/cmake/modules/FindOggVorbis.cmake is written in an unsupported language. File is not indexed.

0001 # - Try to find the OggVorbis libraries
0002 # Once done this will define
0003 #
0004 #  OGGVORBIS_FOUND - system has OggVorbis
0005 #  OGGVORBIS_VERSION - set either to 1 or 2
0006 #  OGGVORBIS_INCLUDE_DIR - the OggVorbis include directory
0007 #  OGGVORBIS_LIBRARIES - The libraries needed to use OggVorbis
0008 #  OGG_LIBRARY         - The Ogg library
0009 #  VORBIS_LIBRARY      - The Vorbis library
0010 #  VORBISFILE_LIBRARY  - The VorbisFile library
0011 #  VORBISENC_LIBRARY   - The VorbisEnc library
0012 
0013 # SPDX-FileCopyrightText: 2006 Richard Laerkaeng <richard@goteborg.utfors.se>
0014 # SPDX-License-Identifier: BSD-3-Clause
0015 
0016 include (CheckLibraryExists)
0017 
0018 find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
0019 find_path(OGG_INCLUDE_DIR ogg/ogg.h)
0020 
0021 find_library(OGG_LIBRARY NAMES ogg)
0022 find_library(VORBIS_LIBRARY NAMES vorbis)
0023 find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
0024 find_library(VORBISENC_LIBRARY NAMES vorbisenc)
0025 
0026 mark_as_advanced(VORBIS_INCLUDE_DIR OGG_INCLUDE_DIR
0027                  OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY VORBISENC_LIBRARY)
0028 
0029 
0030 if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY)
0031 
0032    set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBISENC_LIBRARY})
0033 
0034    set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES})
0035    set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OGGVORBIS_LIBRARIES})
0036    check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2)
0037    set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_TMP})
0038 
0039    if (HAVE_LIBVORBISENC2)
0040       set (OGGVORBIS_VERSION 2)
0041    else (HAVE_LIBVORBISENC2)
0042       set (OGGVORBIS_VERSION 1)
0043    endif (HAVE_LIBVORBISENC2)
0044 
0045 endif (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY)
0046 
0047 
0048 include(FindPackageHandleStandardArgs)
0049 find_package_handle_standard_args(OggVorbis REQUIRED_VARS VORBIS_LIBRARY OGG_LIBRARY VORBISFILE_LIBRARY VORBISENC_LIBRARY
0050                                                           VORBIS_INCLUDE_DIR OGG_INCLUDE_DIR)
0051 
0052 #check_include_files(vorbis/vorbisfile.h HAVE_VORBISFILE_H)
0053 #check_library_exists(ogg ogg_page_version "" HAVE_LIBOGG)
0054 #check_library_exists(vorbis vorbis_info_init "" HAVE_LIBVORBIS)
0055 #check_library_exists(vorbisfile ov_open "" HAVE_LIBVORBISFILE)
0056 #check_library_exists(vorbisenc vorbis_info_clear "" HAVE_LIBVORBISENC)
0057 #check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2)
0058 
0059 #if (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC)
0060 #    message(STATUS "Ogg/Vorbis found")
0061 #    set (VORBIS_LIBS "-lvorbis -logg")
0062 #    set (VORBISFILE_LIBS "-lvorbisfile")
0063 #    set (VORBISENC_LIBS "-lvorbisenc")
0064 #    set (OGGVORBIS_FOUND TRUE)
0065 #    if (HAVE_LIBVORBISENC2)
0066 #        set (HAVE_VORBIS 2)
0067 #    else (HAVE_LIBVORBISENC2)
0068 #        set (HAVE_VORBIS 1)
0069 #    endif (HAVE_LIBVORBISENC2)
0070 #else (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC)
0071 #    message(STATUS "Ogg/Vorbis not found")
0072 #endif (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC)
0073