FindPhysFS.cmake 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Locate PhysFS library
  2. # This module defines
  3. # PHYSFS_LIBRARY, the name of the library to link against
  4. # PHYSFS_FOUND, if false, do not try to link to PHYSFS
  5. # PHYSFS_INCLUDE_DIR, where to find PHYSFS/PHYSFS.h
  6. #
  7. # $PHYSFSDIR is an environment variable that would
  8. # correspond to the ./configure --prefix=$PHYSFSDIR
  9. # used in building PHYSFS.
  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. # PHYSFS_LIBRARY to override this selection.
  16. FIND_PATH(PHYSFS_INCLUDE_DIR physfs.h
  17. ~/Library/Frameworks/PhysFS.framework/Headers
  18. /Library/Frameworks/PhysFS.framework/Headers
  19. $ENV{PHYSFSDIR}/include
  20. /usr/include
  21. /usr/include/physfs
  22. /usr/local/include/physfs
  23. /sw/include
  24. /sw/include/physfs
  25. )
  26. # I'm not sure if I should do a special casing for Apple. It is
  27. # unlikely that other Unix systems will find the framework path.
  28. # But if they do ([Next|Open|GNU]Step?),
  29. # do they want the -framework option also?
  30. IF(${PHYSFS_INCLUDE_DIR} MATCHES ".framework")
  31. SET (PHYSFS_LIBRARY "-framework PhysFS" CACHE STRING "PhysFS framework for OSX")
  32. ELSE(${PHYSFS_INCLUDE_DIR} MATCHES ".framework")
  33. FIND_LIBRARY(PHYSFS_LIBRARY
  34. NAMES physfs PhysFS
  35. PATHS
  36. $ENV{PHYSFSDIR}/lib
  37. /usr/lib
  38. /usr/local/lib
  39. /sw/lib
  40. )
  41. ENDIF(${PHYSFS_INCLUDE_DIR} MATCHES ".framework")
  42. SET(PHYSFS_FOUND "NO")
  43. IF(PHYSFS_LIBRARY)
  44. SET(PHYSFS_FOUND "YES")
  45. ENDIF(PHYSFS_LIBRARY)