FindGDAL.cmake 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. $ENV{GDAL_DIR}
  22. NO_DEFAULT_PATH
  23. PATH_SUFFIXES include
  24. )
  25. FIND_PATH(GDAL_INCLUDE_DIR gdal.h
  26. PATHS
  27. ~/Library/Frameworks/gdal.framework/Headers
  28. /Library/Frameworks/gdal.framework/Headers
  29. /usr/local/include/gdal
  30. /usr/local/include/GDAL
  31. /usr/local/include
  32. /usr/include/gdal
  33. /usr/include/GDAL
  34. /usr/include
  35. /sw/include/gdal
  36. /sw/include/GDAL
  37. /sw/include # Fink
  38. /opt/local/include/gdal
  39. /opt/local/include/GDAL
  40. /opt/local/include # DarwinPorts
  41. /opt/csw/include/gdal
  42. /opt/csw/include/GDAL
  43. /opt/csw/include # Blastwave
  44. /opt/include/gdal
  45. /opt/include/GDAL
  46. /opt/include
  47. )
  48. FIND_LIBRARY(GDAL_LIBRARY
  49. NAMES gdal GDAL
  50. PATHS
  51. $ENV{GDAL_DIR}
  52. NO_DEFAULT_PATH
  53. PATH_SUFFIXES lib64 lib
  54. )
  55. FIND_LIBRARY(GDAL_LIBRARY
  56. NAMES gdal GDAL
  57. PATHS
  58. ~/Library/Frameworks
  59. /Library/Frameworks
  60. /usr/local
  61. /usr
  62. /sw
  63. /opt/local
  64. /opt/csw
  65. /opt
  66. /usr/freeware
  67. [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;GDAL_ROOT]/lib
  68. PATH_SUFFIXES lib64 lib
  69. )
  70. SET(GDAL_FOUND "NO")
  71. IF(GDAL_LIBRARY AND GDAL_INCLUDE_DIR)
  72. SET(GDAL_FOUND "YES")
  73. ENDIF(GDAL_LIBRARY AND GDAL_INCLUDE_DIR)