Ticket #31034: patch-findgdal.diff

File patch-findgdal.diff, 2.9 KB (added by cmutel (Chris Mutel), 13 years ago)
  • cmake/FindGDAL.cmake

    old new  
    3838ELSE(WIN32)
    3939  IF(UNIX)
    4040
    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 
    7041    IF (NOT GDAL_INCLUDE_DIR OR NOT GDAL_LIBRARY OR NOT GDAL_CONFIG)
    7142      # didn't find OS X framework, and was not set by user
    7243      SET(GDAL_CONFIG_PREFER_PATH "$ENV{GDAL_HOME}/bin" CACHE STRING "preferred path to GDAL (gdal-config)")
     
    146117          STRING(REGEX REPLACE "[-][l]" "" GDAL_LIB_NAME ${GDAL_LIB_NAME_WITH_PREFIX} )
    147118        ENDIF (GDAL_LIB_NAME_WITH_PREFIX)
    148119
    149         IF (APPLE)
    150           IF (NOT GDAL_LIBRARY)
    151             # work around empty GDAL_LIBRARY left by framework check
    152             # while still preserving user setting if given
    153             # ***FIXME*** need to improve framework check so below not needed
    154             SET(GDAL_LIBRARY ${GDAL_LINK_DIRECTORIES}/lib${GDAL_LIB_NAME}.dylib CACHE STRING INTERNAL FORCE)
    155           ENDIF (NOT GDAL_LIBRARY)
    156         ELSE (APPLE)
    157           SET(GDAL_LIBRARY ${GDAL_LINK_DIRECTORIES}/lib${GDAL_LIB_NAME}.so CACHE STRING INTERNAL)
    158         ENDIF (APPLE)
    159      
    160120      ELSE(GDAL_CONFIG)
    161121        MESSAGE("FindGDAL.cmake: gdal-config not found. Please set it manually. GDAL_CONFIG=${GDAL_CONFIG}")
    162122      ENDIF(GDAL_CONFIG)