FindOggVorbis.cmake 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. find_path(OGGVORBIS_OGG_INCLUDE_DIR NAMES ogg/ogg.h PATHS "${PROJECT_SOURCE_DIR}/dependencies/include")
  12. find_path(OGGVORBIS_VORBIS_INCLUDE_DIR NAMES vorbis/vorbisfile.h PATHS "${PROJECT_SOURCE_DIR}/dependencies/include")
  13. find_library(OGGVORBIS_OGG_LIBRARY NAMES ogg Ogg libogg PATHS "${PROJECT_SOURCE_DIR}/dependencies/lib")
  14. find_library(OGGVORBIS_VORBIS_LIBRARY NAMES vorbis Vorbis libvorbis PATHS "${PROJECT_SOURCE_DIR}/dependencies/lib")
  15. find_library(OGGVORBIS_VORBISFILE_LIBRARY NAMES vorbisfile libvorbisfile PATHS "${PROJECT_SOURCE_DIR}/dependencies/lib")
  16. if (APPLE)
  17. set(OGGVORBIS_OGG_INCLUDE_DIR "/Library/Frameworks/Ogg.framework/Headers/")
  18. set(OGGVORBIS_VORBIS_INCLUDE_DIR "/Library/Frameworks/Vorbis.framework/Headers/")
  19. endif()
  20. if(APPLE AND NOT OGGVORBIS_VORBISFILE_LIBRARY)
  21. # Seems to be the same on Apple systems
  22. set(OGGVORBIS_VORBISFILE_LIBRARY ${OGGVORBIS_VORBIS_LIBRARY})
  23. endif()
  24. include(FindPackageHandleStandardArgs)
  25. find_package_handle_standard_args(OggVorbis DEFAULT_MSG
  26. OGGVORBIS_OGG_INCLUDE_DIR OGGVORBIS_VORBIS_INCLUDE_DIR
  27. OGGVORBIS_OGG_LIBRARY OGGVORBIS_VORBIS_LIBRARY OGGVORBIS_VORBISFILE_LIBRARY)
  28. # Publish variables
  29. set(OGGVORBIS_INCLUDE_DIRS ${OGGVORBIS_OGG_INCLUDE_DIR} ${OGGVORBIS_VORBIS_INCLUDE_DIR})
  30. set(OGGVORBIS_LIBRARIES ${OGGVORBIS_OGG_LIBRARY} ${OGGVORBIS_VORBIS_LIBRARY} ${OGGVORBIS_VORBISFILE_LIBRARY})
  31. list(REMOVE_DUPLICATES OGGVORBIS_INCLUDE_DIRS)
  32. list(REMOVE_DUPLICATES OGGVORBIS_LIBRARIES)
  33. mark_as_advanced(OGGVORBIS_OGG_INCLUDE_DIR OGGVORBIS_VORBIS_INCLUDE_DIR)
  34. mark_as_advanced(OGGVORBIS_OGG_LIBRARY OGGVORBIS_VORBIS_LIBRARY OGGVORBIS_VORBISFILE_LIBRARY)