diff --git a/CMakeLists.txt b/CMakeLists.txt
index f700fbebc147c1ea3e37fb3f864a46a77c2ac2ca..28763f81e40252d07f2920ad6fa69feaf539dea5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -117,11 +117,7 @@ IF(OGS_USE_LIS)
 ENDIF()
 
 IF(OGS_USE_PETSC)
-    MESSAGE(STATUS "PETSc version is ${PETSC_VERSION}")
     ADD_DEFINITIONS(-DUSE_PETSC)
-    IF(PETSC_VERSION VERSION_GREATER 3.4)
-      ADD_DEFINITIONS(-DPETSC_V35)
-    ENDIF(PETSC_VERSION VERSION_GREATER 3.4) 
 ENDIF()
 
 IF(OGS_USE_EIGEN)
diff --git a/MathLib/LinAlg/PETSc/PETScLinearSolver.cpp b/MathLib/LinAlg/PETSc/PETScLinearSolver.cpp
index ed7dda9779260e16ba56ec66ad883a04af7990d3..2a3d6d2fefb5ec9842058a50536fe230c16eb598 100644
--- a/MathLib/LinAlg/PETSc/PETScLinearSolver.cpp
+++ b/MathLib/LinAlg/PETSc/PETScLinearSolver.cpp
@@ -41,9 +41,9 @@ bool PETScLinearSolver::solve(const PETScVector &b, PETScVector &x)
     PetscMemoryGetCurrentUsage(&mem1);
 #endif
 
-#ifdef PETSC_V35
+#if (PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR > 4)
     KSPSetOperators(_solver, _A.getRawMatrix(), _A.getRawMatrix());
-#else 
+#else
     KSPSetOperators(_solver, _A.getRawMatrix(), _A.getRawMatrix(), DIFFERENT_NONZERO_PATTERN);
 #endif