2019-03-21 03:23:47 +01:00
|
|
|
# - Find vorbisenc
|
|
|
|
# Find the native vorbisenc includes and libraries
|
2019-03-17 19:36:55 +01:00
|
|
|
#
|
2019-03-21 03:23:47 +01:00
|
|
|
# VORBIS_INCLUDE_DIRS - where to find vorbis.h, etc.
|
|
|
|
# VORBIS_LIBRARIES - List of libraries when using vorbis.
|
|
|
|
# VORBIS_FOUND - True if vorbis found.
|
|
|
|
|
|
|
|
# Comes from https://github.com/erikd/libsndfile/blob/master/cmake/FindVorbis.cmake
|
2019-03-17 19:36:55 +01:00
|
|
|
|
|
|
|
if(VORBIS_INCLUDE_DIR)
|
|
|
|
# Already in cache, be silent
|
|
|
|
set(VORBIS_FIND_QUIETLY TRUE)
|
|
|
|
endif()
|
|
|
|
|
2019-03-21 03:23:47 +01:00
|
|
|
find_package(Ogg QUIET)
|
|
|
|
|
|
|
|
find_package(PkgConfig QUIET)
|
|
|
|
pkg_check_modules(PC_VORBIS QUIET vorbis)
|
|
|
|
|
|
|
|
set(VORBIS_VERSION ${PC_VORBIS_VERSION})
|
|
|
|
|
|
|
|
find_path(VORBIS_INCLUDE_DIR vorbis/codec.h
|
|
|
|
HINTS
|
|
|
|
${PC_VORBIS_INCLUDEDIR}
|
|
|
|
${PC_VORBIS_INCLUDE_DIRS}
|
|
|
|
${VORBIS_ROOT}
|
|
|
|
)
|
|
|
|
|
|
|
|
find_library(VORBIS_LIBRARY
|
|
|
|
NAMES
|
|
|
|
vorbis
|
|
|
|
vorbis_static
|
|
|
|
libvorbis
|
|
|
|
libvorbis_static
|
|
|
|
HINTS
|
|
|
|
${PC_VORBIS_LIBDIR}
|
|
|
|
${PC_VORBIS_LIBRARY_DIRS}
|
|
|
|
${VORBIS_ROOT}
|
|
|
|
)
|
|
|
|
|
|
|
|
# Handle the QUIETLY and REQUIRED arguments and set VORBIS_FOUND
|
|
|
|
# to TRUE if all listed variables are TRUE.
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(Vorbis
|
|
|
|
REQUIRED_VARS
|
|
|
|
VORBIS_LIBRARY
|
|
|
|
VORBIS_INCLUDE_DIR
|
|
|
|
OGG_FOUND
|
|
|
|
VERSION_VAR
|
|
|
|
VORBIS_VERSION
|
|
|
|
)
|
2019-03-17 19:36:55 +01:00
|
|
|
|
|
|
|
if(VORBIS_FOUND)
|
2019-03-21 03:23:47 +01:00
|
|
|
set(VORBIS_INCLUDE_DIRS ${VORBIS_INCLUDE_DIR})
|
|
|
|
set(VORBIS_LIBRARIES ${VORBIS_LIBRARY} ${OGG_LIBRARIES})
|
|
|
|
if(NOT TARGET Vorbis::Vorbis)
|
|
|
|
add_library(Vorbis::Vorbis UNKNOWN IMPORTED)
|
|
|
|
set_target_properties(Vorbis::Vorbis PROPERTIES
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${VORBIS_INCLUDE_DIR}"
|
|
|
|
IMPORTED_LOCATION "${VORBIS_LIBRARY}"
|
|
|
|
INTERFACE_LINK_LIBRARIES Ogg::Ogg
|
|
|
|
)
|
|
|
|
endif()
|
2019-03-17 19:36:55 +01:00
|
|
|
endif()
|
|
|
|
|
2019-03-21 03:23:47 +01:00
|
|
|
mark_as_advanced(VORBIS_INCLUDE_DIR VORBIS_LIBRARY)
|