From 7749607e2620ca01dd2af9bd11372a618cd92a87 Mon Sep 17 00:00:00 2001
From: Michael Kuron <mkuron@icp.uni-stuttgart.de>
Date: Mon, 22 Feb 2021 15:48:32 +0100
Subject: [PATCH] Explicitly fall back to C++14 with older CUDA

---
 CMakeLists.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 36c6831d5..e70d89fa2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -495,8 +495,9 @@ else()
    endif()
 endif()
 
-if (WALBERLA_BUILD_WITH_CUDA AND CUDA_VERSION VERSION_LESS "11.0")
+if (WALBERLA_BUILD_WITH_CUDA AND (CUDA_VERSION VERSION_LESS "11.0" OR CMAKE_VERSION VERSION_LESS 3.18.0))
    # CUDA < 11 does not support C++17. std::experimental::any works with C++14, unlike std::any.
+   set(CMAKE_CUDA_STANDARD 14)
    set(WALBERLA_USE_STD_EXPERIMENTAL_ANY 1)
 endif()
 
@@ -1051,7 +1052,6 @@ if ( WALBERLA_BUILD_WITH_CUDA )
 
       #CUDA_FOUND is need for our cmake mechanism
       set ( CUDA_FOUND TRUE )
-      set(CMAKE_CUDA_STANDARD_REQUIRED OFF)
     else()
       set ( WALBERLA_BUILD_WITH_CUDA FALSE )
     endif ( )
-- 
GitLab