[mapguide-commits] r9264 - in sandbox/jng/cmake_v2: . Common Common/Geometry Common/MapGuideCommon Oem Oem/CsMapLibrary Oem/geos Oem/geos/tools cmake/modules

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Dec 25 07:19:09 PST 2017


Author: jng
Date: 2017-12-25 07:19:09 -0800 (Mon, 25 Dec 2017)
New Revision: 9264

Added:
   sandbox/jng/cmake_v2/Oem/CsMapLibrary/
   sandbox/jng/cmake_v2/Oem/CsMapLibrary/CMakeLists.txt
   sandbox/jng/cmake_v2/Oem/CsMapLibrary/README.txt
   sandbox/jng/cmake_v2/Oem/geos/tools/geos_svn_revision_cmake.h.in
Modified:
   sandbox/jng/cmake_v2/CMakeLists.txt
   sandbox/jng/cmake_v2/Common/CMakeLists.txt
   sandbox/jng/cmake_v2/Common/Geometry/CMakeLists.txt
   sandbox/jng/cmake_v2/Common/MapGuideCommon/CMakeLists.txt
   sandbox/jng/cmake_v2/Oem/CMakeLists.txt
   sandbox/jng/cmake_v2/Oem/geos/geos_svn_revision.h
   sandbox/jng/cmake_v2/cmake/modules/FindGD.cmake
   sandbox/jng/cmake_v2/cmake/modules/FindGEOS.cmake
Log:
CMake-ify CS-Map and the rest of Common. All of Common can now be built with CMake

Modified: sandbox/jng/cmake_v2/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/CMakeLists.txt	2017-12-25 14:50:51 UTC (rev 9263)
+++ sandbox/jng/cmake_v2/CMakeLists.txt	2017-12-25 15:19:09 UTC (rev 9264)
@@ -23,6 +23,7 @@
 set(MG_VERSION_RELEASE 0)
 set(MG_VERSION "${MG_VERSION_MAJOR}.${MG_VERSION_MINOR}.${MG_VERSION_RELEASE}")
 
+set(MG_OEM_CSMAP_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Oem/CsMap/Include")
 set(MG_OEM_AGG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Oem/agg-2.4")
 set(MG_OEM_AGG_INCLUDE_DIR "${MG_OEM_AGG_DIR}/include")
 set(MG_OEM_AGG_FREETYPE_DIR "${MG_OEM_AGG_DIR}/font_freetype")

Modified: sandbox/jng/cmake_v2/Common/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/Common/CMakeLists.txt	2017-12-25 14:50:51 UTC (rev 9263)
+++ sandbox/jng/cmake_v2/Common/CMakeLists.txt	2017-12-25 15:19:09 UTC (rev 9264)
@@ -10,11 +10,11 @@
 add_definitions( -DACE_HAS_THREAD_SAFE_ACCEPT )
 
 add_subdirectory(Foundation)
-#add_subdirectory(Geometry)
-#add_subdirectory(MapGuideCommon)
+add_subdirectory(Geometry)
+add_subdirectory(MapGuideCommon)
 add_subdirectory(MdfModel)
 add_subdirectory(MdfParser)
-#add_subdirectory(PlatformBase)
+add_subdirectory(PlatformBase)
 add_subdirectory(Renderers)
 add_subdirectory(Security)
 add_subdirectory(Stylization)

Modified: sandbox/jng/cmake_v2/Common/Geometry/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/Common/Geometry/CMakeLists.txt	2017-12-25 14:50:51 UTC (rev 9263)
+++ sandbox/jng/cmake_v2/Common/Geometry/CMakeLists.txt	2017-12-25 15:19:09 UTC (rev 9264)
@@ -1,6 +1,14 @@
 project(geometry)
 
-set (MgGeometry_LIBRARY MgGeometry-${MG_VERSION})
+include_directories(${ACE_INCLUDE_DIR}
+    ${GEOS_INCLUDE_DIR}
+    ${MG_OEM_CSMAP_INCLUDE_DIR}
+    ${CMAKE_CURRENT_SOURCE_DIR}/../CoordinateSystem
+    ${CMAKE_CURRENT_SOURCE_DIR}/../Security
+    ${CMAKE_CURRENT_SOURCE_DIR}/../MdfPaser
+    ${CMAKE_CURRENT_SOURCE_DIR}/../MdfModel
+    ${CMAKE_CURRENT_SOURCE_DIR}/../Foundation
+    ${CMAKE_CURRENT_SOURCE_DIR}/../Geometry)
 
 set (MgGeometry_SRCS
     GeometryBuild.cpp
@@ -55,12 +63,14 @@
     ../CoordinateSystem/SmartCriticalClass.cpp
 )
 
-add_library(${MgGeometry_LIBRARY} SHARED ${MgGeometry_SRCS})
+add_library(MgGeometry-${MG_VERSION} SHARED ${MgGeometry_SRCS})
 
-target_link_libraries(${MgGeometry_LIBRARY}
-    ${MgFoundation_LIBRARY}
+target_link_libraries(MgGeometry-${MG_VERSION}
+    MgFoundation-${MG_VERSION}
+    CsMap
     ${ACE_LIBRARY}
     ${GEOS_LIBRARY}
+    pthread
 )
 
 #install( TARGETS ${MgGeometry_LIBRARY} DESTINATION ${LIB_INSTALL_DIR} )
\ No newline at end of file

Modified: sandbox/jng/cmake_v2/Common/MapGuideCommon/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/Common/MapGuideCommon/CMakeLists.txt	2017-12-25 14:50:51 UTC (rev 9263)
+++ sandbox/jng/cmake_v2/Common/MapGuideCommon/CMakeLists.txt	2017-12-25 15:19:09 UTC (rev 9264)
@@ -2,6 +2,7 @@
 
 include_directories(${ACE_INCLUDE_DIR}
     ${XERCESC_INCLUDE_DIR}
+    ${CMAKE_CURRENT_SOURCE_DIR}
     ${CMAKE_CURRENT_SOURCE_DIR}/../PlatformBase
     ${CMAKE_CURRENT_SOURCE_DIR}/../CoordinateSystem
     ${CMAKE_CURRENT_SOURCE_DIR}/../Security

Modified: sandbox/jng/cmake_v2/Oem/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/Oem/CMakeLists.txt	2017-12-25 14:50:51 UTC (rev 9263)
+++ sandbox/jng/cmake_v2/Oem/CMakeLists.txt	2017-12-25 15:19:09 UTC (rev 9264)
@@ -1 +1,8 @@
-add_subdirectory(DWFTK)
\ No newline at end of file
+#TODO: We have geos in-tree, which is CMake-enabled, so if required we can use
+#the internal copy of geos if required through an option like INTERNAL_GEOS
+#at the moment, we are just using the system-provided version of GEOS
+
+#set(GEOS_ENABLE_TESTS OFF)
+#add_subdirectory(geos)
+add_subdirectory(DWFTK)
+add_subdirectory(CsMapLibrary)
\ No newline at end of file

Added: sandbox/jng/cmake_v2/Oem/CsMapLibrary/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/Oem/CsMapLibrary/CMakeLists.txt	                        (rev 0)
+++ sandbox/jng/cmake_v2/Oem/CsMapLibrary/CMakeLists.txt	2017-12-25 15:19:09 UTC (rev 9264)
@@ -0,0 +1,142 @@
+include_directories(${MG_OEM_CSMAP_INCLUDE_DIR})
+
+add_definitions(-DCSCOMPARE -DCSAPI -DMG)
+
+set (CsMap_SRCS
+    ../CsMap/Source/CS_alber.c
+    ../CsMap/Source/CS_angle.c
+    ../CsMap/Source/CS_ansi.c
+    ../CsMap/Source/CS_ats77.c
+    ../CsMap/Source/CS_azmea.c
+    ../CsMap/Source/CS_azmed.c
+    ../CsMap/Source/CS_badekas.c
+    ../CsMap/Source/CS_bonne.c
+    ../CsMap/Source/CS_bpcnc.c
+    ../CsMap/Source/CS_bursa.c
+    ../CsMap/Source/CS_bynFile.c
+    ../CsMap/Source/CS_category.c
+    ../CsMap/Source/CS_csini.c
+    ../CsMap/Source/CS_csio.c
+    ../CsMap/Source/CS_csprm.c
+    ../CsMap/Source/CS_csvFileSupport.cpp
+    ../CsMap/Source/CS_csWktLoc.c
+    ../CsMap/Source/CS_ctio.c
+    ../CsMap/Source/CS_datum.c
+    ../CsMap/Source/CS_defaults.c
+    ../CsMap/Source/CS_defCmp.c
+    ../CsMap/Source/CS_defCmpEx.c
+    ../CsMap/Source/CS_dtcalc.c
+    ../CsMap/Source/CS_dtio.c
+    ../CsMap/Source/CS_dtmBridge.c
+    ../CsMap/Source/CS_edcnc.c
+    ../CsMap/Source/CS_edcyl.c
+    ../CsMap/Source/CS_egm96.c
+    ../CsMap/Source/CS_ekrt4.c
+    ../CsMap/Source/CS_ekrt6.c
+    ../CsMap/Source/CS_elCalc.c
+    ../CsMap/Source/CS_elio.c
+    ../CsMap/Source/CS_epsgStuff.cpp
+    ../CsMap/Source/CS_epsgSupport.cpp
+    ../CsMap/Source/CS_erpt.c
+    ../CsMap/Source/CS_error.c
+    ../CsMap/Source/CS_fips.c
+    ../CsMap/Source/CS_frame.c
+    ../CsMap/Source/CS_frnch.c
+    ../CsMap/Source/CS_gauss.c
+    ../CsMap/Source/CS_general.c
+    ../CsMap/Source/CS_geocn.c
+    ../CsMap/Source/CS_geoct.c
+    ../CsMap/Source/CS_geoid96.c
+    ../CsMap/Source/CS_geoid99.c
+    ../CsMap/Source/CS_geoidHeight.c
+    ../CsMap/Source/CS_gissupprt.c
+    ../CsMap/Source/CS_gnomc.c
+    ../CsMap/Source/CS_gpio.c
+    ../CsMap/Source/CS_gridi.c
+    ../CsMap/Source/CS_groups.c
+    ../CsMap/Source/CS_guiApi.c
+    ../CsMap/Source/CS_gxIndex.c
+    ../CsMap/Source/CS_gxio.c
+    ../CsMap/Source/CS_gxprm.c
+    ../CsMap/Source/CS_hlApi.c
+    ../CsMap/Source/CS_hmlsn.c
+    ../CsMap/Source/CS_hpApi.c
+    ../CsMap/Source/CS_japan.c
+    ../CsMap/Source/CS_krovk.c
+    ../CsMap/Source/CS_lmbrt.c
+    ../CsMap/Source/CS_lmtan.c
+    ../CsMap/Source/CS_mgrs.c
+    ../CsMap/Source/CS_millr.c
+    ../CsMap/Source/CS_modpc.c
+    ../CsMap/Source/CS_molod.c
+    ../CsMap/Source/CS_molwd.c
+    ../CsMap/Source/CS_mrcat.c
+    ../CsMap/Source/CS_mstro.c
+    ../CsMap/Source/CS_mulrg.c
+    ../CsMap/Source/CS_nacyl.c
+    ../CsMap/Source/CS_nadcn.c
+    ../CsMap/Source/CS_nameMapper.cpp
+    ../CsMap/Source/CS_nameMapperSupport.cpp
+    ../CsMap/Source/CS_nerth.c
+    ../CsMap/Source/CS_ntv1.c
+    ../CsMap/Source/CS_ntv2.c
+    ../CsMap/Source/CS_nullx.c
+    ../CsMap/Source/CS_nzlnd.c
+    ../CsMap/Source/CS_oblqm.c
+    ../CsMap/Source/CS_optional.c
+    ../CsMap/Source/CS_ortho.c
+    ../CsMap/Source/CS_osgm91.c
+    ../CsMap/Source/CS_ost02.c
+    ../CsMap/Source/CS_ost97.c
+    ../CsMap/Source/CS_ostn02.c
+    ../CsMap/Source/CS_ostn97.c
+    ../CsMap/Source/CS_ostro.c
+    ../CsMap/Source/CS_parm3.c
+    ../CsMap/Source/CS_parm4.c
+    ../CsMap/Source/CS_parm6.c
+    ../CsMap/Source/CS_parm7.c
+    ../CsMap/Source/CS_plycn.c
+    ../CsMap/Source/CS_plynm.c
+    ../CsMap/Source/CS_pstro.c
+    ../CsMap/Source/CS_rlsUpdt.c
+    ../CsMap/Source/CS_robin.c
+    ../CsMap/Source/CS_sinus.c
+    ../CsMap/Source/CS_sstro.c
+    ../CsMap/Source/CS_supprt.c
+    ../CsMap/Source/CS_swiss.c
+    ../CsMap/Source/CS_sys34.c
+    ../CsMap/Source/CS_system.c
+    ../CsMap/Source/CS_tacyl.c
+    ../CsMap/Source/CS_trmer.c
+    ../CsMap/Source/CS_trmrs.c
+    ../CsMap/Source/CS_units.c
+    ../CsMap/Source/CS_unity.c
+    ../CsMap/Source/CS_vdgrn.c
+    ../CsMap/Source/CS_vertconUS.c
+    ../CsMap/Source/CS_vrtcon.c
+    ../CsMap/Source/CS_wellknowntext.cpp
+    ../CsMap/Source/CS_wgs72.c
+    ../CsMap/Source/CS_winkelTripel.c
+    ../CsMap/Source/CS_wktObject.cpp
+    ../CsMap/Source/CS_wktObjKonstants.cpp
+    ../CsMap/Source/CS_zones.c
+    ../CsMap/Source/CScs2Wkt.cpp
+    ../CsMap/Source/CScscomp.c
+    ../CsMap/Source/CSdata.c
+    ../CsMap/Source/CSdataDT.c
+    ../CsMap/Source/CSdataPJ.c
+    ../CsMap/Source/CSdataU.c
+    ../CsMap/Source/CSdatumCatalog.c
+    ../CsMap/Source/CSdictDiff.c
+    ../CsMap/Source/CSdt2Wkt.cpp
+    ../CsMap/Source/CSdtcomp.c
+    ../CsMap/Source/CSel2Wkt.cpp
+    ../CsMap/Source/CSelcomp.c
+    ../CsMap/Source/CSgeodeticSupport.c
+    ../CsMap/Source/CSgpcomp.c
+    ../CsMap/Source/CSgxcomp.c
+    ../CsMap/Source/CSwktFlavors.c
+    ../CsMap/Source/csIoUtil.cpp
+)
+
+add_library(CsMap STATIC ${CsMap_SRCS})
\ No newline at end of file

Added: sandbox/jng/cmake_v2/Oem/CsMapLibrary/README.txt
===================================================================
--- sandbox/jng/cmake_v2/Oem/CsMapLibrary/README.txt	                        (rev 0)
+++ sandbox/jng/cmake_v2/Oem/CsMapLibrary/README.txt	2017-12-25 15:19:09 UTC (rev 9264)
@@ -0,0 +1,3 @@
+This directory contains a CMake build configuration for CS-Map
+
+It sits in this directory instead of CsMap as that is a SVN external, though in practice we should be upstanding OSS citizens and upstream a proper CMake build configuration in CS-Map itself.
\ No newline at end of file

Modified: sandbox/jng/cmake_v2/Oem/geos/geos_svn_revision.h
===================================================================
--- sandbox/jng/cmake_v2/Oem/geos/geos_svn_revision.h	2017-12-25 14:50:51 UTC (rev 9263)
+++ sandbox/jng/cmake_v2/Oem/geos/geos_svn_revision.h	2017-12-25 15:19:09 UTC (rev 9264)
@@ -1 +1 @@
-#define GEOS_SVN_REVISION 3921
+#define GEOS_SVN_REVISION 9261

Added: sandbox/jng/cmake_v2/Oem/geos/tools/geos_svn_revision_cmake.h.in
===================================================================
--- sandbox/jng/cmake_v2/Oem/geos/tools/geos_svn_revision_cmake.h.in	                        (rev 0)
+++ sandbox/jng/cmake_v2/Oem/geos/tools/geos_svn_revision_cmake.h.in	2017-12-25 15:19:09 UTC (rev 9264)
@@ -0,0 +1 @@
+#cmakedefine GEOS_SVN_REVISION @GEOS_SVN_REVISION@

Modified: sandbox/jng/cmake_v2/cmake/modules/FindGD.cmake
===================================================================
--- sandbox/jng/cmake_v2/cmake/modules/FindGD.cmake	2017-12-25 14:50:51 UTC (rev 9263)
+++ sandbox/jng/cmake_v2/cmake/modules/FindGD.cmake	2017-12-25 15:19:09 UTC (rev 9264)
@@ -1,9 +1,9 @@
-# - Find PostgreSQL
-# Find the PostgreSQL includes and client library
+# - Find GD
+# Find the GD includes and client library
 # This module defines
-#  POSTGRESQL_INCLUDE_DIR, where to find POSTGRESQL.h
-#  POSTGRESQL_LIBRARIES, the libraries needed to use POSTGRESQL.
-#  POSTGRESQL_FOUND, If false, do not try to use PostgreSQL.
+#  GD_INCLUDE_DIR, where to find gd.h
+#  GD_LIBRARY, the libraries needed to use GD.
+#  GD_FOUND, If false, do not try to use GD.
 
 find_path(GD_INCLUDE_DIR NAMES "gd.h")
 find_library(GD_LIBRARY NAMES gd)

Modified: sandbox/jng/cmake_v2/cmake/modules/FindGEOS.cmake
===================================================================
--- sandbox/jng/cmake_v2/cmake/modules/FindGEOS.cmake	2017-12-25 14:50:51 UTC (rev 9263)
+++ sandbox/jng/cmake_v2/cmake/modules/FindGEOS.cmake	2017-12-25 15:19:09 UTC (rev 9264)
@@ -1,175 +1,27 @@
-# Find GEOS
-# ~~~~~~~~~
-# Copyright (c) 2008, Mateusz Loskot <mateusz at loskot.net>
-# (based on FindGDAL.cmake by Magnus Homann)
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-#
-# CMake module to search for GEOS library
-#
-# If it's found it sets GEOS_FOUND to TRUE
-# and following variables are set:
-#    GEOS_INCLUDE_DIR
-#    GEOS_LIBRARY
-#
+# - Find GEOS
+# Find the GEOS includes and client library. NOTE: This concerns the C++ library, not the geos_c C API.
+# This module defines
+#  GEOS_INCLUDE_DIR, where to find geos headers
+#  GEOS_LIBRARY, the libraries needed to use GEOS.
+#  GEOS_FOUND, If false, do not try to use GEOS.
 
-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)
- 
-IF(WIN32)
+find_path(GEOS_INCLUDE_DIR 
+  NAMES "geos/version.h"
+        "geos/geom.h"
+        "geos/util.h"
+        "geos/io.h"
+        "geos/unload.h")
+find_library(GEOS_LIBRARY NAMES geos)
 
-  IF (MINGW)
-    FIND_PATH(GEOS_INCLUDE_DIR geos_c.h /usr/local/include /usr/include c:/msys/local/include)
-    FIND_LIBRARY(GEOS_LIBRARY NAMES geos_c PATHS /usr/local/lib /usr/lib c:/msys/local/lib)
-  ENDIF (MINGW)
+include(FindPackageHandleStandardArgs)
 
-  IF (MSVC)
-    FIND_PATH(GEOS_INCLUDE_DIR geos_c.h $ENV{LIB_DIR}/include $ENV{INCLUDE})
-    FIND_LIBRARY(GEOS_LIBRARY NAMES geos geos_c_i PATHS
-      "$ENV{LIB}/lib"
-      $ENV{LIB}
-      #mingw
-      c:/msys/local/lib
-      NO_DEFAULT_PATH
-      )
-    IF (GEOS_LIBRARY)
-       SET (
-         GEOS_LIBRARY
-         GEOS_LIBRARY;odbc32;odbccp32
-         CACHE STRING INTERNAL)
-    ENDIF (GEOS_LIBRARY)
-  ENDIF (MSVC)
+# handle the QUIETLY and REQUIRED arguments and set CPPUNIT_FOUND to TRUE if 
+# all listed variables are TRUE
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GEOS DEFAULT_MSG GEOS_LIBRARY GEOS_INCLUDE_DIR)
 
-ELSE(WIN32)
+if (GEOS_FOUND)
+   message(STATUS "Found libGEOS: ${GEOS_INCLUDE_DIR}, ${GEOS_LIBRARY}")
+endif (GEOS_FOUND)
 
- IF(UNIX)
+mark_as_advanced(GEOS_INCLUDE_DIR GEOS_LIBRARY)
 
-    # try to use framework on mac
-    # want clean framework path, not unix compatibility path
-    IF (APPLE)
-      IF (CMAKE_FIND_FRAMEWORK MATCHES "FIRST"
-          OR CMAKE_FRAMEWORK_PATH MATCHES "ONLY"
-          OR NOT CMAKE_FIND_FRAMEWORK)
-        SET (CMAKE_FIND_FRAMEWORK_save ${CMAKE_FIND_FRAMEWORK} CACHE STRING "" FORCE)
-        SET (CMAKE_FIND_FRAMEWORK "ONLY" CACHE STRING "" FORCE)
-        FIND_LIBRARY(GEOS_LIBRARY GEOS)
-        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 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}")
-        ENDIF (GEOS_LIBRARY)
-        SET (CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_save} CACHE STRING "" FORCE)
-      ENDIF ()
-    ENDIF (APPLE)
-
-    IF (NOT GEOS_INCLUDE_DIR OR NOT GEOS_LIBRARY OR NOT GEOS_CONFIG)
-      # didn't find OS X framework, and was not set by user
-      SET(GEOS_CONFIG_PREFER_PATH "$ENV{GEOS_HOME}/bin" CACHE STRING "preferred path to GEOS (geos-config)")
-      FIND_PROGRAM(GEOS_CONFIG geos-config
-          ${GEOS_CONFIG_PREFER_PATH}
-          /usr/local/bin/
-          /usr/bin/
-          )
-      #MESSAGE("DBG GEOS_CONFIG ${GEOS_CONFIG}")
-
-      IF (GEOS_CONFIG)
-
-        EXEC_PROGRAM(${GEOS_CONFIG}
-            ARGS --version
-            OUTPUT_VARIABLE 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}")
-
-        # set INCLUDE_DIR to prefix+include
-        EXEC_PROGRAM(${GEOS_CONFIG}
-            ARGS --prefix
-            OUTPUT_VARIABLE GEOS_PREFIX)
-
-        FIND_PATH(GEOS_INCLUDE_DIR
-            geos_c.h
-            ${GEOS_PREFIX}/include
-            /usr/local/include
-            /usr/include
-            )
-
-        ## extract link dirs for rpath
-        EXEC_PROGRAM(${GEOS_CONFIG}
-            ARGS --libs
-            OUTPUT_VARIABLE GEOS_CONFIG_LIBS )
-
-        ## split off the link dirs (for rpath)
-        ## use regular expression to match wildcard equivalent "-L*<endchar>"
-        ## with <endchar> is a space or a semicolon
-        STRING(REGEX MATCHALL "[-][L]([^ ;])+"
-            GEOS_LINK_DIRECTORIES_WITH_PREFIX
-            "${GEOS_CONFIG_LIBS}" )
-        #MESSAGE("DBG  GEOS_LINK_DIRECTORIES_WITH_PREFIX=${GEOS_LINK_DIRECTORIES_WITH_PREFIX}")
-
-        ## remove prefix -L because we need the pure directory for LINK_DIRECTORIES
-
-        IF (GEOS_LINK_DIRECTORIES_WITH_PREFIX)
-          STRING(REGEX REPLACE "[-][L]" "" GEOS_LINK_DIRECTORIES ${GEOS_LINK_DIRECTORIES_WITH_PREFIX} )
-        ENDIF (GEOS_LINK_DIRECTORIES_WITH_PREFIX)
-
-        ### XXX - mloskot: geos-config --libs does not return -lgeos_c, so set it manually
-        ## split off the name
-        ## use regular expression to match wildcard equivalent "-l*<endchar>"
-        ## with <endchar> is a space or a semicolon
-        #STRING(REGEX MATCHALL "[-][l]([^ ;])+"
-        #  GEOS_LIB_NAME_WITH_PREFIX
-        #  "${GEOS_CONFIG_LIBS}" )
-        #MESSAGE("DBG  GEOS_CONFIG_LIBS=${GEOS_CONFIG_LIBS}")
-        #MESSAGE("DBG  GEOS_LIB_NAME_WITH_PREFIX=${GEOS_LIB_NAME_WITH_PREFIX}")
-        SET(GEOS_LIB_NAME_WITH_PREFIX -lgeos_c CACHE STRING INTERNAL)
-
-        ## remove prefix -l because we need the pure name
-
-        IF (GEOS_LIB_NAME_WITH_PREFIX)
-          STRING(REGEX REPLACE "[-][l]" "" GEOS_LIB_NAME ${GEOS_LIB_NAME_WITH_PREFIX} )
-        ENDIF (GEOS_LIB_NAME_WITH_PREFIX)
-        #MESSAGE("DBG  GEOS_LIB_NAME=${GEOS_LIB_NAME}")
-
-        IF (APPLE)
-          IF (NOT GEOS_LIBRARY)
-            # work around empty GEOS_LIBRARY left by framework check
-            # while still preserving user setting if given
-            # ***FIXME*** need to improve framework check so below not needed
-            SET(GEOS_LIBRARY ${GEOS_LINK_DIRECTORIES}/lib${GEOS_LIB_NAME}.dylib CACHE STRING INTERNAL FORCE)
-          ENDIF (NOT GEOS_LIBRARY)
-        ELSE (APPLE)
-          SET(GEOS_LIBRARY ${GEOS_LINK_DIRECTORIES}/lib${GEOS_LIB_NAME}.so CACHE STRING INTERNAL)
-        ENDIF (APPLE)
-        #MESSAGE("DBG  GEOS_LIBRARY=${GEOS_LIBRARY}")
-
-      ELSE(GEOS_CONFIG)
-        MESSAGE("FindGEOS.cmake: geos-config not found. Please set it manually. GEOS_CONFIG=${GEOS_CONFIG}")
-      ENDIF(GEOS_CONFIG)
-    ENDIF(NOT GEOS_INCLUDE_DIR OR NOT GEOS_LIBRARY OR NOT GEOS_CONFIG)
-  ENDIF(UNIX)
-ENDIF(WIN32)
-
-# Handle the QUIETLY and REQUIRED arguments and set GEOS_FOUND to TRUE
-# if all listed variables are TRUE
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(GEOS
-                                  REQUIRED_VARS GEOS_LIBRARY GEOS_INCLUDE_DIR
-                                  VERSION_VAR GEOS_VERSION)
-
-# Hide internal variables
-mark_as_advanced(GEOS_LIBRARY GEOS_INCLUDE_DIR)
\ No newline at end of file



More information about the mapguide-commits mailing list