From 503c7d1ca87400dc1e83902a88b84d83912106ee Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Thu, 12 Oct 2017 17:27:46 +0200 Subject: [PATCH] make the PETSc code compile even if PETSc is not available if PETSc is not available, the .cpp file will compile fine because it will be reduced to be empty, but trying to include LinearSolverPetsc.hpp in this case will result in an error. --- opm/core/linalg/LinearSolverPetsc.cpp | 4 ++++ opm/core/linalg/LinearSolverPetsc.hpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/opm/core/linalg/LinearSolverPetsc.cpp b/opm/core/linalg/LinearSolverPetsc.cpp index 57823aad2..89521aff5 100644 --- a/opm/core/linalg/LinearSolverPetsc.cpp +++ b/opm/core/linalg/LinearSolverPetsc.cpp @@ -19,6 +19,9 @@ */ #include "config.h" + +#if HAVE_PETSC + #include #include #include @@ -287,3 +290,4 @@ namespace{ } // namespace Opm +#endif // HAVE_PETSC diff --git a/opm/core/linalg/LinearSolverPetsc.hpp b/opm/core/linalg/LinearSolverPetsc.hpp index c5ba9a504..e8b9931c5 100644 --- a/opm/core/linalg/LinearSolverPetsc.hpp +++ b/opm/core/linalg/LinearSolverPetsc.hpp @@ -20,6 +20,11 @@ #ifndef OPM_LINEARSOLVERPETSC_HEADER_INCLUDED #define OPM_LINEARSOLVERPETSC_HEADER_INCLUDED + +#if !HAVE_PETSC +#error "LinearSolverPetsc.hpp included, but the PETSc libraries are not available!" +#endif + #include #include #include