From b2b3a2da18579c9f6cc6849eded94fd57aadadc2 Mon Sep 17 00:00:00 2001
From: Mario Ceresa <mrceresa@gmail.com>
Date: Wed, 10 Oct 2012 18:55:13 +0200
Subject: [PATCH 16/23] Manage KL library 2/2 (Submitted by Volker Frohlich)
Signed-off-by: Mario Ceresa <mrceresa@gmail.com>
---
contrib/gel/gelmods/FindKL.cmake | 30 ++++++++++++++++++++++++
contrib/gel/gelmods/FindKL2.cmake | 49 +++++++++++++++++++++++++++++++++++++++
2 files changed, 79 insertions(+)
create mode 100644 contrib/gel/gelmods/FindKL.cmake
create mode 100644 contrib/gel/gelmods/FindKL2.cmake
diff --git a/contrib/gel/gelmods/FindKL.cmake b/contrib/gel/gelmods/FindKL.cmake
new file mode 100644
index 0000000..e79e485
--- /dev/null
+++ b/contrib/gel/gelmods/FindKL.cmake
@@ -0,0 +1,30 @@
+# - Find KL library
+# Find the native KL includes and library
+# This module defines
+# KL_INCLUDE_DIR, where to find klt.h, etc.
+# KL_LIBRARIES, libraries to link against to use KL.
+# KL_FOUND, If false, do not try to use KL.
+# also defined, but not for general use are
+# KL_LIBRARY, where to find the KL library.
+
+FIND_PATH( KL_INCLUDE_DIR klt.h
+ /usr/include
+ /usr/include/klt
+ /usr/local/include
+)
+
+SET( KL_NAMES ${KL_NAMES} klt )
+FIND_LIBRARY( KL_LIBRARY
+ NAMES ${KL_NAMES}
+ PATHS /usr/lib
+ /usr/lib64
+ /usr/local/lib
+)
+
+SET( KL_FOUND "NO" )
+IF( KL_INCLUDE_DIR )
+ IF( KL_LIBRARY )
+ SET( KL_FOUND "YES" )
+ SET( KL_LIBRARIES ${KL_LIBRARY} )
+ ENDIF( KL_LIBRARY )
+ENDIF( KL_INCLUDE_DIR )
diff --git a/contrib/gel/gelmods/FindKL2.cmake b/contrib/gel/gelmods/FindKL2.cmake
new file mode 100644
index 0000000..daffa59
--- /dev/null
+++ b/contrib/gel/gelmods/FindKL2.cmake
@@ -0,0 +1,49 @@
+#
+# Find a KL library
+#
+# This file is used to manage using either a natively provided KL library or the one in v3p if provided.
+#
+#
+# As per the standard scheme the following definitions are used
+# KL_INCLUDE_DIR - where to find geotiff.h
+# KL_LIBRARIES - the set of libraries to include to use KL.
+# KL_FOUND - TRUE, if available somewhere on the system.
+
+# Additionally
+# VXL_USING_NATIVE_KL - True if we are using a KL library provided outside vxl (or v3p)
+
+
+# If this FORCE variable is unset or is FALSE, try to find a native library.
+IF( VXL_FORCE_V3P_KL )
+ELSE( VXL_FORCE_V3P_KL )
+ INCLUDE( ${MODULE_PATH}/NewCMake/FindKL.cmake )
+ENDIF( VXL_FORCE_V3P_KL )
+
+
+IF(KL_FOUND)
+
+ SET(VXL_USING_NATIVE_KL "YES")
+
+ELSE(KL_FOUND)
+
+ #
+ # At some point, in a "release" version, it is possible that someone
+ # will not have the v3p geotiff library, so make sure the headers
+ # exist.
+ #
+
+ IF(EXISTS ${vxl_SOURCE_DIR}/contrib/gel/vgel/kl/klt.h)
+ # Use FIND_PATH here to allow the user to set the path to IGNORE
+ # to disable geotiff support.
+ FIND_PATH(KL_INCLUDE_DIR klt.h
+ ${vxl_SOURCE_DIR}/v3p/geotiff
+ )
+ IF( KL_INCLUDE_DIR )
+ SET( KL_FOUND "YES" )
+ SET( KL_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_DIR}/include/vxl/v3p/geotiff)
+ SET( KL_LIBRARIES geotiff )
+ ENDIF( KL_INCLUDE_DIR )
+
+ ENDIF(EXISTS ${vxl_SOURCE_DIR}/v3p/geotiff/geotiff.h)
+
+ENDIF(KL_FOUND)
--
1.7.11.7