Saxum/extern/acgl/cmake/FindVORBIS.cmake

64 lines
2.0 KiB
CMake
Raw Permalink Normal View History

2014-10-20 15:31:26 +00:00
# - Find libvorbis
# Find the native vorbis headers
#
# VORBIS_INCLUDE_DIR - where to find vorbisenc.h, etc.
# VORBIS_LIBRARIES - vorbis library
# VORBIS_DEFINES - vorbis defines
# VORBIS_FOUND - True if vorbis found.
IF(VORBIS_FOUND)
# Already in cache, be silent
SET(VORBIS_FIND_QUIETLY TRUE)
ENDIF()
#INCLUDE(${CMAKE_CURRENT_LIST_DIR}/DefinesVORBIS.txt)
IF(BUILD_VORBIS OR ACGL_GLOBAL_EXTERN_DIR_FOUND_FIRST_TIME OR BUILD_TYPE_CHANGED)
UNSET(VORBIS_INCLUDE_DIR CACHE)
UNSET(VORBIS_LIBRARIES CACHE)
ENDIF()
IF(BUILD_VORBIS)
SET(VORBIS_INCLUDE_DIR "${ACGL_LOCAL_EXTERN_DIR}/vorbis/include")
SET(VORBIS_LIBRARIES vorbis${COMPILE_POSTFIX})
ELSE()
# Look for the header file.
IF(ACGL_GLOBAL_EXTERN_DIR)
FIND_PATH(VORBIS_INCLUDE_DIR NAMES vorbis/vorbisenc.h PATHS "${ACGL_GLOBAL_EXTERN_DIR}/vorbis/include" NO_DEFAULT_PATH)
ENDIF()
IF(NOT VORBIS_INCLUDE_DIR)
FIND_PATH(VORBIS_INCLUDE_DIR NAMES vorbis/vorbisenc.h)
ENDIF()
# Look for the library file.
IF(ACGL_GLOBAL_EXTERN_DIR)
FIND_LIBRARY(VORBIS_LIBRARIES NAMES vorbis${COMPILE_POSTFIX} PATHS "${ACGL_GLOBAL_EXTERN_DIR}/vorbis/lib" NO_DEFAULT_PATH)
ENDIF()
IF(NOT VORBIS_LIBRARIES)
FIND_LIBRARY(VORBIS_LIBRARIES NAMES vorbis)
ENDIF()
ENDIF()
# Copy the results to the output variables.
IF(VORBIS_INCLUDE_DIR AND VORBIS_LIBRARIES)
SET(VORBIS_FOUND TRUE CACHE INTERNAL "")
ELSE()
SET(VORBIS_FOUND FALSE CACHE INTERNAL "")
ENDIF()
# Report the results.
IF(NOT VORBIS_FOUND)
SET(VORBIS_MESSAGE "vorbis was not found. Make sure VORBIS_INCLUDE_DIR AND VORBIS_LIBRARIES are set correctly.")
IF(VORBIS_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "${VORBIS_MESSAGE}")
ELSEIF(NOT VORBIS_FIND_QUIETLY)
MESSAGE(STATUS "${VORBIS_MESSAGE}")
ENDIF()
ELSEIF(NOT VORBIS_FIND_QUIETLY)
MESSAGE(STATUS "Looking for vorbis - found")
ENDIF()
MESSAGE(STATUS "VORBIS_INCLUDE_DIR:${VORBIS_INCLUDE_DIR}")
MESSAGE(STATUS "VORBIS_LIBRARIES:${VORBIS_LIBRARIES}")