From c6de6dbf36d8972319be591c14093d85692852d4 Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Tue, 24 May 2016 11:41:44 +0200
Subject: [PATCH] [findgstat] Use the dune cmake doc style. Add GSTAT_ROOT
 variable.

The user can set the variable GSTAT_ROOT to the directory where
gstat is installed for cmake to search there first before the
default paths.
---
 cmake/modules/FindGstat.cmake | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/cmake/modules/FindGstat.cmake b/cmake/modules/FindGstat.cmake
index fa4a4ec382..a98409f219 100644
--- a/cmake/modules/FindGstat.cmake
+++ b/cmake/modules/FindGstat.cmake
@@ -1,15 +1,36 @@
+# .. cmake_module::
 #
-# Module that checks whether gstat has been installed
+#    Find the gstat geostatistic library
+#
+#    You may set the following variables to modify the
+#    behaviour of this module:
+#
+#    :ref:`GSTAT_ROOT`
+#       Path list to search for gstat.
+#
+#    Sets the following variables:
+#
+#    :code:`GSTAT_FOUND`
+#       True if the gstat library was found.
+#
+#    :code:`GSTAT_EXECUTABLE`
+#       Path to gstat executable
+#
+# .. cmake_variable:: GSTAT_ROOT
+#
+#   You may set this variable to have :ref:`FindGstat` look
+#   for the gstat library in the given path before inspecting
+#   system paths.
 #
-# Sets the following variables:
-# GSTAT_FOUND         True if gstat was found
-# GSTAT_EXECUTABLE    Path to gstat executable
 
 # look for header files, only at positions given by the user
 find_program(GSTAT_EXECUTABLE
   NAMES gstat
-  PATHS "${CMAKE_SOURCE_DIR}/../external/gstat/src"
+  PATHS "${GSTAT_ROOT}"
+        "${CMAKE_SOURCE_DIR}/../"
         "usr/bin/"
+  PATH_SUFFIXES "src" "external/gstat/src" "gstat/src" "gstat"
+  NO_DEFAULT_PATH
 )
 
 include(FindPackageHandleStandardArgs)
-- 
GitLab