From 13ed8a9234517af2df4cc52a217aaf3fde174207 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= <gruenich@dune-project.org>
Date: Thu, 31 May 2012 11:34:34 +0000
Subject: [PATCH] [CMake] Add HAVE_SUPERLU et al. to config.h. Update test set
 up to handle SuperLU tests correctly.

[[Imported from SVN: r1615]]
---
 cmake/modules/FindSuperLU.cmake | 7 +++++--
 config.h.cmake                  | 9 +++++++++
 dune/istl/test/CMakeLists.txt   | 8 ++++----
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/cmake/modules/FindSuperLU.cmake b/cmake/modules/FindSuperLU.cmake
index 366ba4ee..77d72cf6 100644
--- a/cmake/modules/FindSuperLU.cmake
+++ b/cmake/modules/FindSuperLU.cmake
@@ -72,7 +72,7 @@ if(SUPERLU_FOUND)
     "Determing location of ${SUPERLU_WITH_VERSION} succeded:\n"
     "Include directory: ${SUPERLU_INCLUDE_DIRS}\n"
     "Library directory: ${SUPERLU_LIBRARIES}\n\n")
-  set(SUPERLU_DUNE_COMPILE_FLAGS "-I${SUPERLU_INCLUDE_DIRS} -DENABLE_SUPERLU" CACHE STRING
+  set(SUPERLU_DUNE_COMPILE_FLAGS "-I${SUPERLU_INCLUDE_DIRS}" CACHE STRING
     "Compile flags used by DUNE when compiling SuperLU programs")
   set(SUPERLU_DUNE_LIBRARIES ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES} CACHE STRING
     "Libraries used by DUNE when linking SuperLU programs")
@@ -84,6 +84,9 @@ else(SUPERLU_FOUND)
     "Library directory: ${SUPERLU_LIBRARIES}\n\n")
 endif(SUPERLU_FOUND)
 
+# set HAVE_SUPERLU for config.h
+set(HAVE_SUPERLU SUPERLU_FOUND)
+
 # adds SuperLU flags to the targets
 function(add_dune_superlu_flags _targets)
   if(SUPERLU_FOUND)
@@ -92,7 +95,7 @@ function(add_dune_superlu_flags _targets)
       GET_TARGET_PROPERTY(_props ${_target} COMPILE_FLAGS)
       string(REPLACE "_props-NOTFOUND" "" _props "${_props}")
       SET_TARGET_PROPERTIES(${_target} PROPERTIES COMPILE_FLAGS
-        "${_props} ${PARMETIS_COMPILE_FLAGS} -DENABLE_SUPERLU=1")
+        "${_props} ${SUPERLU_DUNE_COMPILE_FLAGS} -DENABLE_SUPERLU=1")
     endforeach(_target ${_targets})
   endif(SUPERLU_FOUND)
 endfunction(add_dune_superlu_flags)
diff --git a/config.h.cmake b/config.h.cmake
index 47af7b7a..33e07c06 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -39,6 +39,15 @@
    by configure _and_ if the application uses the PARMETIS_CPPFLAGS */
 #define HAVE_PARMETIS ENABLE_PARMETIS
 
+/* Define to ENABLE_SUPERLU if the SuperLU library is available */
+#cmakedefine HAVE_SUPERLU ENABLE_SUPERLU
+
+/* define to 1 because older versions of SuperLU are no longer supported*/
+#define SUPERLU_POST_2005_VERSION 1
+
+/* define to 1 if SuperLU header slu_ddefs.h contains SLU_DOUBLE */
+#cmakedefine SUPERLU_MIN_VERSION_4_3 @SUPERLU_MIN_VERSION_4_3@
+
 /* end dune-istl
    Everything below here will be overwritten
 */
diff --git a/dune/istl/test/CMakeLists.txt b/dune/istl/test/CMakeLists.txt
index cc93af0e..b77f0b07 100644
--- a/dune/istl/test/CMakeLists.txt
+++ b/dune/istl/test/CMakeLists.txt
@@ -6,10 +6,10 @@ if(HAVE_PARDISO)
   set(PARDISOTEST test_pardiso)
 endif(HAVE_PARDISO)
 
-if(HAVE_SUPERLU)
+if(SUPERLU_FOUND)
   set(SUPERLUTESTS superlutest superluztest superluctest superlustest
     overlappingschwarztest)
-endif(HAVE_SUPERLU)
+endif(SUPERLU_FOUND)
 
 if(HAVE_MPI)
   set(MPITESTS vectorcommtest matrixmarkettest matrixredisttest)
@@ -47,7 +47,7 @@ if(HAVE_PARDISO)
   # TODO add pardiso flags
 endif(HAVE_PARDISO)
 
-if(HAVE_SUPERLU)
+if(SUPERLU_FOUND)
   add_executable(superlutest "superlutest.cc")
 
   add_executable(superlustest "superlutest.cc")
@@ -62,7 +62,7 @@ if(HAVE_SUPERLU)
   add_executable(overlappingschwarztest "overlappingschwarztest.cc")
 
   add_dune_superlu_flags("${SUPERLUTESTS}")
-endif(HAVE_SUPERLU)
+endif(SUPERLU_FOUND)
 
 if(HAVE_MPI)
   add_executable(matrixredisttest "matrixredisttest.cc")
-- 
GitLab