FindGDAL.cmake 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # Locate gdal
  2. # This module defines
  3. # GDAL_LIBRARY
  4. # GDAL_FOUND, if false, do not try to link to gdal
  5. # GDAL_INCLUDE_DIR, where to find the headers
  6. #
  7. # $GDALDIR is an environment variable that would
  8. # correspond to the ./configure --prefix=$GDAL_DIR
  9. # used in building gdal.
  10. #
  11. # Created by Eric Wing. I'm not a gdal user, but OpenSceneGraph uses it
  12. # for osgTerrain so I whipped this module together for completeness.
  13. # I actually don't know the conventions or where files are typically
  14. # placed in distros.
  15. # Any real gdal users are encouraged to correct this (but please don't
  16. # break the OS X framework stuff when doing so which is what usually seems
  17. # to happen).
  18. # This makes the presumption that you are include gdal.h like
  19. # #include "gdal.h"
  20. FIND_PATH(GDAL_INCLUDE_DIR gdal.h
  21. HINTS
  22. $ENV{GDAL_DIR}
  23. PATH_SUFFIXES include
  24. PATHS
  25. ~/Library/Frameworks/gdal.framework/Headers
  26. /Library/Frameworks/gdal.framework/Headers
  27. /usr/local/include/gdal
  28. /usr/local/include/GDAL
  29. /usr/local/include
  30. /usr/include/gdal
  31. /usr/include/GDAL
  32. /usr/include
  33. /sw/include/gdal
  34. /sw/include/GDAL
  35. /sw/include # Fink
  36. /opt/local/include/gdal
  37. /opt/local/include/GDAL
  38. /opt/local/include # DarwinPorts
  39. /opt/csw/include/gdal
  40. /opt/csw/include/GDAL
  41. /opt/csw/include # Blastwave
  42. /opt/include/gdal
  43. /opt/include/GDAL
  44. /opt/include
  45. )
  46. FIND_LIBRARY(GDAL_LIBRARY
  47. NAMES gdal GDAL
  48. HINTS
  49. $ENV{GDAL_DIR}
  50. PATH_SUFFIXES lib64 lib
  51. PATHS
  52. ~/Library/Frameworks
  53. /Library/Frameworks
  54. /usr/local
  55. /usr
  56. /sw
  57. /opt/local
  58. /opt/csw
  59. /opt
  60. /usr/freeware
  61. [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;GDAL_ROOT]/lib
  62. )
  63. SET(GDAL_FOUND "NO")
  64. IF(GDAL_LIBRARY AND GDAL_INCLUDE_DIR)
  65. SET(GDAL_FOUND "YES")
  66. ENDIF(GDAL_LIBRARY AND GDAL_INCLUDE_DIR)