Skip to content
Permalink
Browse files

add missing version numbers to Mac framework detection

  • Loading branch information
kyngchaos committed May 29, 2011
1 parent 85e119c commit a917265c4eb73ec2cde075ad7686cb4a9bf7bb66
Showing with 38 additions and 2 deletions.
  1. +13 −1 cmake/FindGDAL.cmake
  2. +13 −1 cmake/FindGEOS.cmake
  3. +12 −0 cmake/MacPlistMacros.cmake
@@ -14,6 +14,7 @@
# GDAL_INCLUDE_DIR = where to find headers


INCLUDE (@CMAKE_SOURCE_DIR@/cmake/MacPlistMacros.cmake)

IF(WIN32)

@@ -49,7 +50,18 @@ ELSE(WIN32)
IF (GDAL_LIBRARY)
# they're all the same in a framework
SET (GDAL_INCLUDE_DIR ${GDAL_LIBRARY}/Headers CACHE PATH "Path to a file.")
SET (GDAL_CONFIG ${GDAL_LIBRARY}/Programs/geos-config CACHE FILEPATH "Path to a program.")
# set GDAL_CONFIG to make later test happy, not used here, may not exist
SET (GDAL_CONFIG ${GDAL_LIBRARY}/unix/bin/gdal-config CACHE FILEPATH "Path to a program.")
# version in info.plist
GET_VERSION_PLIST (${GDAL_LIBRARY}/Resources/Info.plist GDAL_VERSION)
IF (NOT GDAL_VERSION)
MESSAGE (FATAL_ERROR "Could not determine GDAL version from framework.")
ENDIF (NOT GDAL_VERSION)
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" GDAL_VERSION_MAJOR "${GDAL_VERSION}")
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" GDAL_VERSION_MINOR "${GDAL_VERSION}")
IF (GDAL_VERSION_MAJOR LESS 1 OR GDAL_VERSION_MINOR LESS 4)
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 1.4.0 or higher.")
ENDIF (GDAL_VERSION_MAJOR LESS 1 OR GDAL_VERSION_MINOR LESS 4)
ENDIF (GDAL_LIBRARY)
SET (CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_save} CACHE STRING "" FORCE)
ENDIF ()
@@ -13,6 +13,7 @@
# GEOS_LIBRARY
#

INCLUDE (@CMAKE_SOURCE_DIR@/cmake/MacPlistMacros.cmake)

IF(WIN32)

@@ -54,7 +55,18 @@ ELSE(WIN32)
IF (GEOS_LIBRARY)
# they're all the same in a framework
SET (GEOS_INCLUDE_DIR ${GEOS_LIBRARY}/Headers CACHE PATH "Path to a file.")
SET (GEOS_CONFIG ${GEOS_LIBRARY}/Programs/geos-config CACHE FILEPATH "Path to a program.")
# set GEOS_CONFIG to make later test happy, not used here, may not exist
SET (GEOS_CONFIG ${GEOS_LIBRARY}/unix/bin/geos-config CACHE FILEPATH "Path to a program.")
# version in info.plist
GET_VERSION_PLIST (${GEOS_LIBRARY}/Resources/Info.plist GEOS_VERSION)
IF (NOT GEOS_VERSION)
MESSAGE (FATAL_ERROR "Could not determine GEOS version from framework.")
ENDIF (NOT GEOS_VERSION)
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" GEOS_VERSION_MAJOR "${GEOS_VERSION}")
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" GEOS_VERSION_MINOR "${GEOS_VERSION}")
IF (GEOS_VERSION_MAJOR LESS 3)
MESSAGE (FATAL_ERROR "GEOS version is too old (${GEOS_VERSION}). Use 3.0.0 or higher.")
ENDIF (GEOS_VERSION_MAJOR LESS 3)
ENDIF (GEOS_LIBRARY)
SET (CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_save} CACHE STRING "" FORCE)
ENDIF ()
@@ -0,0 +1,12 @@
# Mac Plist Macros

FUNCTION (GET_VERSION_PLIST PLISTFILE OUTVAR)
SET (PVERSION "")
IF (EXISTS ${PLISTFILE})
FILE (READ "${PLISTFILE}" info_plist)
STRING (REGEX REPLACE "\n" "" info_plist "${info_plist}")
STRING (REGEX MATCH "<key>CFBundleShortVersionString</key>[ \t]*<string>([0-9\\.]*)</string>" PLISTVERSION "${info_plist}")
STRING (REGEX REPLACE "<key>CFBundleShortVersionString</key>[ \t]*<string>([0-9\\.]*)</string>" "\\1" PVERSION "${PLISTVERSION}")
ENDIF (EXISTS ${PLISTFILE})
SET (${OUTVAR} ${PVERSION} PARENT_SCOPE)
ENDFUNCTION (GET_VERSION_PLIST)

0 comments on commit a917265

Please sign in to comment.
You can’t perform that action at this time.