FindOpenAL.cmake 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Locate OpenAL
  2. # This module defines
  3. # OPENAL_LIBRARY
  4. # OPENAL_FOUND, if false, do not try to link to OpenAL
  5. # OPENAL_INCLUDE_DIR, where to find the headers
  6. #
  7. # $OPENALDIR is an environment variable that would
  8. # correspond to the ./configure --prefix=$OPENALDIR
  9. # used in building OpenAL.
  10. #
  11. # Created by Eric Wing. This was influenced by the FindSDL.cmake
  12. # module, but with modifications to recognize OS X frameworks.
  13. # On OSX, this will prefer the Framework version (if found) over others.
  14. # People will have to manually change the cache values of
  15. # OPENAL_LIBRARY to override this selection.
  16. # Tiger will include OpenAL as part of the System.
  17. # But for now, we have to look around.
  18. # Other (Unix) systems should be able to utilize the non-framework paths.
  19. FIND_PATH(OPENAL_INCLUDE_DIR al.h
  20. ~/Library/Frameworks/OpenAL.framework/Headers
  21. /Library/Frameworks/OpenAL.framework/Headers
  22. /System/Library/Frameworks/OpenAL.framework/Headers
  23. $ENV{OPENALDIR}/include
  24. /usr/include
  25. /usr/include/AL
  26. /usr/include/OpenAL
  27. /usr/local/include/AL
  28. /usr/local/include/OpenAL
  29. /sw/include
  30. /sw/include/AL
  31. )
  32. # I'm not sure if I should do a special casing for Apple. It is
  33. # unlikely that other Unix systems will find the framework path.
  34. # But if they do ([Next|Open|GNU]Step?),
  35. # do they want the -framework option also?
  36. IF(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
  37. SET (OPENAL_LIBRARY "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
  38. ELSE(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
  39. FIND_LIBRARY(OPENAL_LIBRARY
  40. NAMES openal al
  41. PATHS
  42. $ENV{OPENALDIR}/lib
  43. /usr/lib
  44. /usr/local/lib
  45. /sw/lib
  46. )
  47. ENDIF(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
  48. SET(OPENAL_FOUND "NO")
  49. IF(OPENAL_LIBRARY)
  50. SET(OPENAL_FOUND "YES")
  51. ENDIF(OPENAL_LIBRARY)