41 | | # try to use framework on mac |
42 | | # want clean framework path, not unix compatibility path |
43 | | IF (APPLE) |
44 | | IF (CMAKE_FIND_FRAMEWORK MATCHES "FIRST" |
45 | | OR CMAKE_FRAMEWORK_PATH MATCHES "ONLY" |
46 | | OR NOT CMAKE_FIND_FRAMEWORK) |
47 | | SET (CMAKE_FIND_FRAMEWORK_save ${CMAKE_FIND_FRAMEWORK} CACHE STRING "" FORCE) |
48 | | SET (CMAKE_FIND_FRAMEWORK "ONLY" CACHE STRING "" FORCE) |
49 | | FIND_LIBRARY(GDAL_LIBRARY GDAL) |
50 | | IF (GDAL_LIBRARY) |
51 | | # they're all the same in a framework |
52 | | SET (GDAL_INCLUDE_DIR ${GDAL_LIBRARY}/Headers CACHE PATH "Path to a file.") |
53 | | # set GDAL_CONFIG to make later test happy, not used here, may not exist |
54 | | SET (GDAL_CONFIG ${GDAL_LIBRARY}/unix/bin/gdal-config CACHE FILEPATH "Path to a program.") |
55 | | # version in info.plist |
56 | | GET_VERSION_PLIST (${GDAL_LIBRARY}/Resources/Info.plist GDAL_VERSION) |
57 | | IF (NOT GDAL_VERSION) |
58 | | MESSAGE (FATAL_ERROR "Could not determine GDAL version from framework.") |
59 | | ENDIF (NOT GDAL_VERSION) |
60 | | STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" GDAL_VERSION_MAJOR "${GDAL_VERSION}") |
61 | | STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" GDAL_VERSION_MINOR "${GDAL_VERSION}") |
62 | | IF (GDAL_VERSION_MAJOR LESS 1 OR GDAL_VERSION_MINOR LESS 4) |
63 | | MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 1.4.0 or higher.") |
64 | | ENDIF (GDAL_VERSION_MAJOR LESS 1 OR GDAL_VERSION_MINOR LESS 4) |
65 | | ENDIF (GDAL_LIBRARY) |
66 | | SET (CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_save} CACHE STRING "" FORCE) |
67 | | ENDIF () |
68 | | ENDIF (APPLE) |
69 | | |