2 ### SuperTux - Removed unused vorbisenc library
4 # - Try to find the OggVorbis libraries
5 # Once done this will define
7 # OGGVORBIS_FOUND - system has OggVorbis
8 # OGGVORBIS_VERSION - set either to 1 or 2
9 # OGGVORBIS_INCLUDE_DIR - the OggVorbis include directory
10 # OGGVORBIS_LIBRARIES - The libraries needed to use OggVorbis
11 # OGG_LIBRARY - The Ogg library
12 # VORBIS_LIBRARY - The Vorbis library
13 # VORBISFILE_LIBRARY - The VorbisFile library
14 # Copyright (c) 2006, Richard Laerkaeng, <richard@goteborg.utfors.se>
16 # Redistribution and use is allowed according to the terms of the BSD license.
17 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
19 include (CheckLibraryExists)
20 find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
21 find_library(OGG_LIBRARY NAMES ogg)
22 find_library(VORBIS_LIBRARY NAMES vorbis)
23 find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
24 if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY)
25 set(OGGVORBIS_FOUND TRUE)
26 # [sommer] (for SuperTux) reversed order of libraries, so that cmake 2.4.5 for Windows generates an MSYS Makefile that will link correctly
27 # set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY})
28 set(OGGVORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
29 set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES})
30 set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OGGVORBIS_LIBRARIES})
31 check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2)
32 set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_TMP})
33 if (HAVE_LIBVORBISENC2)
34 set (OGGVORBIS_VERSION 2)
35 else (HAVE_LIBVORBISENC2)
36 set (OGGVORBIS_VERSION 1)
37 endif (HAVE_LIBVORBISENC2)
38 else (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY)
39 set (OGGVORBIS_VERSION)
40 set(OGGVORBIS_FOUND FALSE)
41 endif (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY)
43 if (NOT OggVorbis_FIND_QUIETLY)
44 message(STATUS "Found OggVorbis: ${OGGVORBIS_LIBRARIES}")
45 endif (NOT OggVorbis_FIND_QUIETLY)
46 else (OGGVORBIS_FOUND)
47 if (OggVorbis_FIND_REQUIRED)
48 message(FATAL_ERROR "Could NOT find OggVorbis libraries")
49 endif (OggVorbis_FIND_REQUIRED)
50 if (NOT OggVorbis_FIND_QUIETLY)
51 message(STATUS "Could NOT find OggVorbis libraries")
52 endif (NOT OggVorbis_FIND_QUIETLY)
53 endif (OGGVORBIS_FOUND)
54 #check_include_files(vorbis/vorbisfile.h HAVE_VORBISFILE_H)
55 #check_library_exists(ogg ogg_page_version "" HAVE_LIBOGG)
56 #check_library_exists(vorbis vorbis_info_init "" HAVE_LIBVORBIS)
57 #check_library_exists(vorbisfile ov_open "" HAVE_LIBVORBISFILE)
58 #check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2)
59 #if (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE)
60 # message(STATUS "Ogg/Vorbis found")
61 # set (VORBIS_LIBS "-lvorbis -logg")
62 # set (VORBISFILE_LIBS "-lvorbisfile")
63 # set (OGGVORBIS_FOUND TRUE)
64 # if (HAVE_LIBVORBISENC2)
66 # else (HAVE_LIBVORBISENC2)
68 # endif (HAVE_LIBVORBISENC2)
69 #else (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE)
70 # message(STATUS "Ogg/Vorbis not found")
71 #endif (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE)