speed-dreams-code/cmake/FindVORBISFILE.cmake
pouillot 88863ebc4e Re #755 Enabled menu music by default (cmake-configuration time) + improved portability of FindOGG/Vorbis/VorbisFile.cmake (thanks Joe)
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5148 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 6eb8f314802d00180dbdc2ef672dbf95574f7db8
Former-commit-id: 0a35fda1f923027dd8e27e1f853d61ab5db1d4ad
2013-02-16 17:29:09 +00:00

95 lines
2.7 KiB
CMake

# Locate VORBISFILE libraries ()
# This module defines
# VORBISFILE_LIBRARY : list of lib names
# VORBISFILE_FOUND : if false, do not try to link to VORBISFILE
# VORBISFILE_INCLUDE_DIR : where to find the headers
#
# $VORBISFILE_DIR is an environment variable that would
# correspond to the ./configure --prefix=$VORBISFILE_DIR
# used in building VORBISFILE.
#
# Created by Joe Thompson (based on Jean-Philippe Meuret's FindSOLID.cmake).
# No use to do all of this twice.
IF(VORBISFILE_FOUND)
RETURN()
ENDIF(VORBISFILE_FOUND)
# First, try with PkgConfig if available.
FIND_PACKAGE(PkgConfig)
IF(PKGCONFIG_FOUND)
PKG_CHECK_MODULES(VORBISFILE vorbisfile)
IF(NOT VORBISFILE_FOUND)
PKG_CHECK_MODULES(VORBISFILE VORBISFILE)
ENDIF (NOT VORBISFILE_FOUND)
IF(VORBISFILE_FOUND)
SET(VORBISFILE_FOUND TRUE)
SET(VORBISFILE_INCLUDE_DIR ${VORBISFILE_INCLUDE_DIRS} CACHE STRING "VORBISFILE include paths")
SET(VORBISFILE_LIBRARY ${VORBISFILE_LIBRARIES} CACHE STRING "VORBISFILE library")
MESSAGE(STATUS "Looking for VORBISFILE --- found using pkg-config (${VORBISFILE_LIBRARY})")
RETURN()
ENDIF(VORBISFILE_FOUND)
ENDIF(PKGCONFIG_FOUND)
# Then try the good old way for include dirs.
IF(NOT APPLE)
FIND_PATH(VORBISFILE_INCLUDE_DIR vorbis/vorbisfile.h
HINTS ENV VORBISFILE_DIR
PATH_SUFFIXES
include/vorbis include/VORBIS include
PATHS
/usr /usr/local
DOC "Non-Apple include dir for VORBISFILE")
ELSE(NOT APPLE)
FIND_PATH(VORBISFILE_INCLUDE_DIR vorbisfile.h
HINTS ENV VORBISFILE_DIR
PATH_SUFFIXES
Headers include/vorbis
PATHS
#Additional MacOS Paths
~/Library/Frameworks/VORBIS.framework
/Library/Frameworks/VORBIS.framework
/System/Library/Frameworks/VORBIS.framework # Tiger
/usr /usr/local
DOC "Apple include dir for VORBISFILE")
ENDIF(NOT APPLE)
# Then try the good old way for libs.
FIND_LIBRARY(VORBISFILE_LIBRARY
NAMES vorbisfile
HINTS ENV VORBISFILE_DIR
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
PATHS /usr /usr/local)
IF(WIN32)
FIND_LIBRARY(VORBISFILE_LIBRARY
NAMES vorbisfile
HINTS ENV VORBISFILE_DIR
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
PATHS /usr /usr/local)
ENDIF(WIN32)
IF(VORBISFILE_INCLUDE_DIR AND VORBISFILE_LIBRARY AND (NOT WIN32 OR VORBISFILE_LIBRARY))
SET(VORBISFILE_FOUND TRUE)
ENDIF(VORBISFILE_INCLUDE_DIR AND VORBISFILE_LIBRARY AND (NOT WIN32 OR VORBISFILE_LIBRARY))
IF(VORBISFILE_FOUND)
MESSAGE(STATUS "Looking for VORBISFILE - found (${VORBISFILE_LIBRARY})")
SET(VORBISFILE_LIBRARY ${VORBISFILE_LIBRARY})
IF(WIN32)
SET(VORBISFILE_LIBRARY ${VORBISFILE_LIBRARY})
ENDIF(WIN32)
ELSE(VORBISFILE_FOUND)
MESSAGE(FATAL_ERROR "Could not find VORBISFILE")
ENDIF(VORBISFILE_FOUND)