|
1 # - Try to find the OggVorbis libraries |
|
2 # Once done this will define |
|
3 # |
|
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 |
|
12 |
|
13 # Copyright (c) 2006, Richard Laerkaeng, <richard@goteborg.utfors.se> |
|
14 # |
|
15 # Redistribution and use is allowed according to the terms of the BSD license. |
|
16 # For details see the accompanying COPYING-CMAKE-SCRIPTS file. |
|
17 |
|
18 |
|
19 include (CheckLibraryExists) |
|
20 |
|
21 find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h) |
|
22 find_path(OGG_INCLUDE_DIR ogg/ogg.h) |
|
23 |
|
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) |
|
28 |
|
29 mark_as_advanced(VORBIS_INCLUDE_DIR OGG_INCLUDE_DIR |
|
30 OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY VORBISENC_LIBRARY) |
|
31 |
|
32 |
|
33 if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY) |
|
34 set(OGGVORBIS_FOUND TRUE) |
|
35 |
|
36 set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBISENC_LIBRARY}) |
|
37 |
|
38 set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES}) |
|
39 set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OGGVORBIS_LIBRARIES}) |
|
40 check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2) |
|
41 set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_TMP}) |
|
42 |
|
43 if (HAVE_LIBVORBISENC2) |
|
44 set (OGGVORBIS_VERSION 2) |
|
45 else (HAVE_LIBVORBISENC2) |
|
46 set (OGGVORBIS_VERSION 1) |
|
47 endif (HAVE_LIBVORBISENC2) |
|
48 |
|
49 else (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY) |
|
50 set (OGGVORBIS_VERSION) |
|
51 set(OGGVORBIS_FOUND FALSE) |
|
52 endif (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY) |
|
53 |
|
54 |
|
55 if (OGGVORBIS_FOUND) |
|
56 if (NOT OggVorbis_FIND_QUIETLY) |
|
57 message(STATUS "Found OggVorbis: ${OGGVORBIS_LIBRARIES}") |
|
58 endif (NOT OggVorbis_FIND_QUIETLY) |
|
59 else (OGGVORBIS_FOUND) |
|
60 if (OggVorbis_FIND_REQUIRED) |
|
61 message(FATAL_ERROR "Could NOT find OggVorbis libraries") |
|
62 endif (OggVorbis_FIND_REQUIRED) |
|
63 if (NOT OggVorbis_FIND_QUITELY) |
|
64 message(STATUS "Could NOT find OggVorbis libraries") |
|
65 endif (NOT OggVorbis_FIND_QUITELY) |
|
66 endif (OGGVORBIS_FOUND) |
|
67 |
|
68 #check_include_files(vorbis/vorbisfile.h HAVE_VORBISFILE_H) |
|
69 #check_library_exists(ogg ogg_page_version "" HAVE_LIBOGG) |
|
70 #check_library_exists(vorbis vorbis_info_init "" HAVE_LIBVORBIS) |
|
71 #check_library_exists(vorbisfile ov_open "" HAVE_LIBVORBISFILE) |
|
72 #check_library_exists(vorbisenc vorbis_info_clear "" HAVE_LIBVORBISENC) |
|
73 #check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2) |
|
74 |
|
75 #if (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC) |
|
76 # message(STATUS "Ogg/Vorbis found") |
|
77 # set (VORBIS_LIBS "-lvorbis -logg") |
|
78 # set (VORBISFILE_LIBS "-lvorbisfile") |
|
79 # set (VORBISENC_LIBS "-lvorbisenc") |
|
80 # set (OGGVORBIS_FOUND TRUE) |
|
81 # if (HAVE_LIBVORBISENC2) |
|
82 # set (HAVE_VORBIS 2) |
|
83 # else (HAVE_LIBVORBISENC2) |
|
84 # set (HAVE_VORBIS 1) |
|
85 # endif (HAVE_LIBVORBISENC2) |
|
86 #else (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC) |
|
87 # message(STATUS "Ogg/Vorbis not found") |
|
88 #endif (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC) |
|
89 |
|
90 |