FindOggVorbis.cmake 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # - Find OggVorbis
  2. # Find the OggVorbis includes and libraries
  3. #
  4. # Following variables are provided:
  5. # OGGVORBIS_FOUND
  6. # True if OggVorbis has been found
  7. # OGGVORBIS_INCLUDE_DIRS
  8. # The include directories of OggVorbis
  9. # OGGVORBIS_LIBRARIES
  10. # OggVorbis library list
  11. if((UNIX AND NOT APPLE) OR NINTENDO_SWITCH)
  12. pkg_check_modules(OGGVORBIS vorbisfile)
  13. else()
  14. find_path(OGGVORBIS_OGG_INCLUDE_DIR NAMES ogg/ogg.h PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/include")
  15. find_path(OGGVORBIS_VORBIS_INCLUDE_DIR NAMES vorbis/vorbisfile.h PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/include")
  16. find_library(OGGVORBIS_OGG_LIBRARY NAMES ogg Ogg libogg PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib")
  17. find_library(OGGVORBIS_VORBIS_LIBRARY NAMES vorbis Vorbis libvorbis PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib")
  18. find_library(OGGVORBIS_VORBISFILE_LIBRARY NAMES vorbisfile libvorbisfile PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib")
  19. find_library(OGGVORBIS_VORBISENC_LIBRARY NAMES vorbisenc libvorbisenc PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib")
  20. include(FindPackageHandleStandardArgs)
  21. find_package_handle_standard_args(OggVorbis DEFAULT_MSG
  22. OGGVORBIS_OGG_INCLUDE_DIR OGGVORBIS_VORBIS_INCLUDE_DIR
  23. OGGVORBIS_OGG_LIBRARY OGGVORBIS_VORBIS_LIBRARY OGGVORBIS_VORBISFILE_LIBRARY)
  24. # Publish variables
  25. set(OGGVORBIS_INCLUDE_DIRS ${OGGVORBIS_OGG_INCLUDE_DIR} ${OGGVORBIS_VORBIS_INCLUDE_DIR})
  26. set(OGGVORBIS_LIBRARIES ${OGGVORBIS_OGG_LIBRARY} ${OGGVORBIS_VORBIS_LIBRARY} ${OGGVORBIS_VORBISFILE_LIBRARY} ${OGGVORBIS_VORBISENC_LIBRARY})
  27. list(REMOVE_DUPLICATES OGGVORBIS_INCLUDE_DIRS)
  28. list(REMOVE_DUPLICATES OGGVORBIS_LIBRARIES)
  29. mark_as_advanced(OGGVORBIS_OGG_INCLUDE_DIR OGGVORBIS_VORBIS_INCLUDE_DIR)
  30. mark_as_advanced(OGGVORBIS_OGG_LIBRARY OGGVORBIS_VORBIS_LIBRARY OGGVORBIS_VORBISFILE_LIBRARY OGGVORBIS_VORBISENC_LIBRARY)
  31. endif()