panda3d/cmake/modules/FindVorbisFile.cmake
2019-01-13 11:58:09 -07:00

35 lines
1.1 KiB
CMake

# Filename: FindVorbisFile.cmake
# Authors: CFSworks (13 Jan, 2019)
#
# Usage:
# find_package(VorbisFile [REQUIRED] [QUIET])
#
# Once done this will define:
# VORBISFILE_FOUND - system has Ogg and vorbisfile
# VORBISFILE_INCLUDE_DIRS - the include directory/ies containing vorbis/ and ogg/
# VORBISFILE_LIBRARIES - the paths to the vorbis and vorbisfile libraries
#
# Find Ogg
find_package(Ogg QUIET)
# Find Vorbis
find_path(VORBIS_INCLUDE_DIR NAMES "vorbis/vorbisfile.h")
find_library(VORBIS_vorbis_LIBRARY NAMES "vorbis")
find_library(VORBIS_vorbisfile_LIBRARY NAMES "vorbisfile")
mark_as_advanced(VORBIS_INCLUDE_DIR VORBIS_vorbis_LIBRARY VORBIS_vorbisfile_LIBRARY)
# Define output variables
set(VORBISFILE_INCLUDE_DIRS ${VORBIS_INCLUDE_DIR})
if(NOT OGG_INCLUDE_DIR STREQUAL VORBIS_INCLUDE_DIR)
list(APPEND VORBISFILE_INCLUDE_DIRS ${OGG_INCLUDE_DIR})
endif()
set(VORBISFILE_LIBRARIES ${OGG_LIBRARY} ${VORBIS_vorbis_LIBRARY} ${VORBIS_vorbisfile_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(VorbisFile DEFAULT_MSG
Ogg_FOUND
VORBIS_INCLUDE_DIR VORBIS_vorbis_LIBRARY VORBIS_vorbisfile_LIBRARY)