diff options
author | Laszlo Papp <lpapp@kde.org> | 2011-12-06 15:31:19 +0200 |
---|---|---|
committer | Laszlo Papp <ext-laszlo.papp@nokia.com> | 2011-12-06 15:31:19 +0200 |
commit | aac7a5f81e1c08fa67931a3c5aa2a6ba4e0399d8 (patch) | |
tree | e935d8023a02a025e297b3242953d70719734426 | |
parent | 223688f4e269b0a8dd88fcec1af32f06bf79af74 (diff) |
Add the FindOggVorbis.cmake module to the project since it is not upstreamed yet
-rw-r--r-- | cmake/FindOggVorbis.cmake | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/cmake/FindOggVorbis.cmake b/cmake/FindOggVorbis.cmake new file mode 100644 index 0000000..a7bb105 --- /dev/null +++ b/cmake/FindOggVorbis.cmake @@ -0,0 +1,70 @@ +# - Try to find the OggVorbis libraries +# Once done this will define +# +# OGGVORBIS_FOUND - system has OggVorbis +# OGGVORBIS_VERSION - set either to 1 or 2 +# OGGVORBIS_INCLUDE_DIRS - the OggVorbis include directories +# OGGVORBIS_LIBRARIES - The libraries needed to use OggVorbis +# OGG_LIBRARY - The Ogg library +# VORBIS_LIBRARY - The Vorbis library +# VORBISFILE_LIBRARY - The VorbisFile library +# VORBISENC_LIBRARY - The VorbisEnc library + +# Copyright (c) 2006, Richard Laerkaeng, <richard@goteborg.utfors.se> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +include (CheckFunctionExists) + +find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h) +find_path(OGG_INCLUDE_DIR ogg/ogg.h) + +find_library(OGG_LIBRARY NAMES ogg) +find_library(VORBIS_LIBRARY NAMES vorbis) +find_library(VORBISFILE_LIBRARY NAMES vorbisfile) +find_library(VORBISENC_LIBRARY NAMES vorbisenc) + +mark_as_advanced(VORBIS_INCLUDE_DIR OGG_INCLUDE_DIR + OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY VORBISENC_LIBRARY) + + +if(VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY) + set(OGGVORBIS_FOUND TRUE) + + set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBISENC_LIBRARY}) + set(OGGVORBIS_INCLUDE_DIRS ${OGG_INCLUDE_DIR} ${VORBIS_INCLUDE_DIR}) + + if(VORBISENC_LIBRARY) + set(OGGVORBIS_LIBRARIES ${OGGVORBIS_LIBRARIES} ${VORBISENC_LIBRARY}) + set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OGGVORBIS_LIBRARIES}) + check_function_exists(vorbis_bitrate_addblock HAVE_LIBVORBISENC2) + set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_TMP}) + endif(VORBISENC_LIBRARY) + + if(HAVE_LIBVORBISENC2) + set(OGGVORBIS_VERSION 2) + else(HAVE_LIBVORBISENC2) + set(OGGVORBIS_VERSION 1) + endif(HAVE_LIBVORBISENC2) + +else(VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY) + set(OGGVORBIS_VERSION) + set(OGGVORBIS_FOUND FALSE) +endif(VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY) + + +if(OGGVORBIS_FOUND) + if(NOT OggVorbis_FIND_QUIETLY) + message(STATUS "Found OggVorbis: ${OGGVORBIS_LIBRARIES}") + endif(NOT OggVorbis_FIND_QUIETLY) +else(OGGVORBIS_FOUND) + if(OggVorbis_FIND_REQUIRED) + message(FATAL_ERROR "Could NOT find OggVorbis libraries") + endif(OggVorbis_FIND_REQUIRED) + if(NOT OggVorbis_FIND_QUITELY) + message(STATUS "Could NOT find OggVorbis libraries") + endif(NOT OggVorbis_FIND_QUITELY) +endif(OGGVORBIS_FOUND) |