FindSDL_image.cmake 1.7 KB

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