|
From: <ai...@us...> - 2013-11-27 20:22:21
|
Revision: 12772
http://sourceforge.net/p/plplot/code/12772
Author: airwin
Date: 2013-11-27 20:22:18 +0000 (Wed, 27 Nov 2013)
Log Message:
-----------
Add test for whether the SAHooks type is available from shapelib, and
if the resulting HAVE_SAHOOKS CMake variable is true,
then #define the HAVE_SAHOOKS C macro for src/plmap.c.
Tested by Alan W. Irwin <ai...@us...> on Linux
by checking that the example 19 result (for shapelib 1.3.0) does not
generate the misleading "Unable to open" error messages
from shapelib that you get when HAVE_SAHOOKS is not true.
Modified Paths:
--------------
trunk/cmake/modules/shapelib.cmake
trunk/src/CMakeLists.txt
Modified: trunk/cmake/modules/shapelib.cmake
===================================================================
--- trunk/cmake/modules/shapelib.cmake 2013-11-27 18:22:39 UTC (rev 12771)
+++ trunk/cmake/modules/shapelib.cmake 2013-11-27 20:22:18 UTC (rev 12772)
@@ -1,7 +1,7 @@
# cmake/modules/shapefil.cmake
#
# Copyright (C) 2012 Andrew Ross
-# Copyright (C) 2012 Alan W. Irwin
+# Copyright (C) 2012-2013 Alan W. Irwin
#
# This file is part of PLplot.
#
@@ -27,7 +27,7 @@
)
# Look for shapelib libraries
-if (HAVE_SHAPELIB)
+if(HAVE_SHAPELIB)
find_package(Shapelib)
if(SHAPELIB_FOUND)
set(SHAPELIB_RPATH ${SHAPELIB_LIBRARY_DIRS})
@@ -41,4 +41,24 @@
FORCE
)
endif(SHAPELIB_FOUND)
-endif (HAVE_SHAPELIB)
+endif(HAVE_SHAPELIB)
+
+if(HAVE_SHAPELIB)
+ # See if shapelib is a modern version with access to SAHooks type.
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/Check_SAHooks.c
+ "#include <shapefil.h>
+void main(void){SAHooks sHooks;}
+"
+ )
+ try_compile(HAVE_SAHOOKS ${CMAKE_BINARY_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}/Check_SAHooks.c
+ CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${SHAPELIB_INCLUDE_DIR}"
+ )
+ if(NOT HAVE_SAHOOKS)
+ message(STATUS "WARNING: the (rather ancient) version of shapelib that has been found does not
+ include the SAHooks type. Therefore, the misleading \"Unable to open ...\"
+ error messages that shapelib generates as PLplot checks several directories
+ for specified shapefiles will not be quieted."
+ )
+ endif(NOT HAVE_SAHOOKS)
+endif(HAVE_SHAPELIB)
Modified: trunk/src/CMakeLists.txt
===================================================================
--- trunk/src/CMakeLists.txt 2013-11-27 18:22:39 UTC (rev 12771)
+++ trunk/src/CMakeLists.txt 2013-11-27 20:22:18 UTC (rev 12772)
@@ -371,7 +371,17 @@
if(NOT PLMAP_COMPILE_PROPS)
set(PLMAP_COMPILE_PROPS)
endif(NOT PLMAP_COMPILE_PROPS)
- set_source_files_properties(plmap.c PROPERTIES COMPILE_FLAGS "${PLMAP_COMPILE_PROPS} -I${SHAPELIB_INCLUDE_DIR}")
+ set_source_files_properties(plmap.c
+ PROPERTIES
+ COMPILE_FLAGS "${PLMAP_COMPILE_PROPS} -I${SHAPELIB_INCLUDE_DIR}"
+ )
+ if(HAVE_SAHOOKS)
+ set_source_files_properties(plmap.c
+ PROPERTIES
+ COMPILE_DEFINITIONS HAVE_SAHOOKS
+ )
+ endif(HAVE_SAHOOKS)
+
set(
libplplot${LIB_TAG}_LINK_LIBRARIES
${libplplot${LIB_TAG}_LINK_LIBRARIES}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|