From f2107b4ba36df7d4be84a021c9a1b0f6c1824a3c Mon Sep 17 00:00:00 2001
From: Thorsten Hater <24411438+thorstenhater@users.noreply.github.com>
Date: Wed, 16 Mar 2022 10:02:20 +0100
Subject: [PATCH] Include CMAKE+CUDA iff NVCC is needed. (#1855)

---
 CMakeLists.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 04a6c9b5..94365d11 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -97,7 +97,6 @@ option(ARB_WITH_PYTHON "enable Python front end" OFF)
 set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
 include(GitSubmodule) # required for check_git_submodule
 include(ErrorTarget)  # reguired for add_error_target
-include(FindCUDAToolkit)
 
 # Set release as the default build type (CMake default is debug.)
 
@@ -110,6 +109,7 @@ endif()
 # Add CUDA as a language if GPU support requested. (This has to be set early so
 # as to enable CUDA tests in generator expressions.)
 if(ARB_GPU STREQUAL "cuda")
+    include(FindCUDAToolkit)
     set(ARB_WITH_NVCC TRUE)
     # CMake 3.18 and later set the default CUDA architecture for
     # each target according to CMAKE_CUDA_ARCHITECTURES. 
@@ -128,6 +128,7 @@ if(ARB_GPU STREQUAL "cuda")
         endif()
     endif()
 elseif(ARB_GPU STREQUAL "cuda-clang")
+    include(FindCUDAToolkit)
     set(ARB_WITH_CUDA_CLANG TRUE)
     enable_language(CUDA)
 elseif(ARB_GPU STREQUAL "hip")
-- 
GitLab