FindOpenAL.cmake 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 OpenAL32
  41. PATHS
  42. $ENV{OPENALDIR}/lib
  43. $ENV{OPENALDIR}/libs
  44. /usr/lib
  45. /usr/local/lib
  46. /sw/lib
  47. )
  48. ENDIF(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
  49. SET(OPENAL_FOUND "NO")
  50. IF(OPENAL_LIBRARY)
  51. SET(OPENAL_FOUND "YES")
  52. ENDIF(OPENAL_LIBRARY)