From 90afe75840ef312634049e1bfe4f05e28d85d987 Mon Sep 17 00:00:00 2001
From: Norihiro Watanabe <norihiro.watanabe@ufz.de>
Date: Tue, 11 Dec 2012 18:30:18 +0100
Subject: [PATCH] improve FindLis.cmake - support LIS_ROOT_DIR - add some hints
 to find it

---
 scripts/cmake/cmake/FindLIS.cmake | 60 ++++++++++++-------------------
 1 file changed, 23 insertions(+), 37 deletions(-)

diff --git a/scripts/cmake/cmake/FindLIS.cmake b/scripts/cmake/cmake/FindLIS.cmake
index 4f63536d512..4deb12a127f 100644
--- a/scripts/cmake/cmake/FindLIS.cmake
+++ b/scripts/cmake/cmake/FindLIS.cmake
@@ -5,44 +5,30 @@
 #  LIS_INCLUDE_DIRS
 #  LIS_LIBRARIES
 
-if (NOT LIS_FOUND)
-
-	include(LibFindMacros)
+set(LIS_ROOT_DIR
+    "${LIS_ROOT_DIR}"
+    CACHE
+    PATH
+    "Directory to search for Lis library")
 	
-	find_path( LIS_INCLUDE_DIR
-		NAMES lis.h
-		PATHS ${CMAKE_SOURCE_DIR}/../Libs/precompiled)
+find_path( LIS_INCLUDE_DIR
+	NAMES lis.h
+	HINTS
+	${LIS_ROOT_DIR}/include
+    /usr/include/lis
+    $ENV{HOME}/include/
+	)
 
-	if ( UNIX )
-		# Tell if the unix system is on 64-bit base
-		if(CMAKE_SIZEOF_VOID_P MATCHES "8")
-			find_library(LIS_LIBRARIES
-				NAMES lis-64
-				PATHS ${CMAKE_SOURCE_DIR}/../Libs/precompiled )	
-		else (CMAKE_SIZEOF_VOID_P MATCHES "8")
-			find_library(LIS_LIBRARIES
-				NAMES lis-32
-				PATHS ${CMAKE_SOURCE_DIR}/../Libs/precompiled )	
-		endif (CMAKE_SIZEOF_VOID_P MATCHES "8")
-	else ( UNIX )			
-		find_library(LIS_LIBRARIES
-			NAMES lisomp
-			PATHS ${CMAKE_SOURCE_DIR}/../Libs/precompiled )	
-	endif ( UNIX )
+find_library(LIS_LIBRARY
+    NAMES lis
+    HINTS 
+    ${LIS_ROOT_DIR}/lib
+    /usr/lib
+    $ENV{HOME}/lib/
+    ) 
 
-	# Set the include dir variables and the libraries and let libfind_process do the rest.
-	# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
-	if (NOT LIS_LIBRARIES STREQUAL "LIS_LIBRARIES-NOTFOUND" AND NOT LIS_INCLUDE_DIR STREQUAL "LIS_INCLUDE_DIR-NOTFOUND")
-		set(LIS_PROCESS_INCLUDES LIS_INCLUDE_DIR)
-		set(LIS_PROCESS_LIBS LIS_LIBRARIES)
-		libfind_process(LIS)
-	else (NOT LIS_LIBRARIES STREQUAL "LIS_LIBRARIES-NOTFOUND" AND NOT LIS_INCLUDE_DIR STREQUAL "LIS_INCLUDE_DIR-NOTFOUND")
-		message (STATUS "Warning: LIS not found!")
-	endif (NOT LIS_LIBRARIES STREQUAL "LIS_LIBRARIES-NOTFOUND" AND NOT LIS_INCLUDE_DIR STREQUAL "LIS_INCLUDE_DIR-NOTFOUND")
-	
-endif (NOT LIS_FOUND)
+SET(LIS_LIBRARIES ${LIS_LIBRARY})
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIS DEFAULT_MSG LIS_LIBRARY LIS_INCLUDE_DIR)
 
-if(LIS_FOUND)
-	INCLUDE_DIRECTORIES( ${LIS_INCLUDE_DIR} )
-	message(STATUS "LIS found (include: ${LIS_INCLUDE_DIR})")
-endif(LIS_FOUND)
-- 
GitLab