diff --git a/dumux/io/cakegridcreator.hh b/dumux/io/cakegridcreator.hh
index c2bc79619cee491195cd4c7c3aa808040a66f33c..89aebc5bc58628b52a010ee68ace9f16d4d73d6b 100644
--- a/dumux/io/cakegridcreator.hh
+++ b/dumux/io/cakegridcreator.hh
@@ -30,6 +30,7 @@
 #include <cmath>
 #include <algorithm>
 
+#include <dune/common/version.hh>
 #include <dune/common/dynvector.hh>
 #include <dune/grid/common/gridfactory.hh>
 #include <dumux/common/properties.hh>
@@ -274,8 +275,11 @@ public:
         std::vector<Scalar> dA = polarCoordinates[1];
 
         GridFactory gridFactory;
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+        constexpr auto type = Dune::GeometryTypes::cube(dim);
+#else
         Dune::GeometryType type; type.makeCube(dim);
-
+#endif
         // create nodes
         if (dim == 3)
         {