From 1ad55fc81d0f6fcc06896eb5ca70af680ae90c19 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Wed, 16 Aug 2017 16:23:00 +0200 Subject: [PATCH] CMake: Make CUDA detection more robust --- cmake/configure/configure_1_cuda.cmake | 10 ++++++++++ cmake/modules/FindCUDA.cmake | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cmake/configure/configure_1_cuda.cmake b/cmake/configure/configure_1_cuda.cmake index ca8f42a163..4b514a1f6d 100644 --- a/cmake/configure/configure_1_cuda.cmake +++ b/cmake/configure/configure_1_cuda.cmake @@ -24,6 +24,11 @@ SET(DEAL_II_WITH_CUDA FALSE CACHE BOOL "") MACRO(FEATURE_CUDA_FIND_EXTERNAL var) + # + # TODO: Ultimately, this find_package call is not needed any more. We + # still use it because it is very convenient to (a) check that CUDA is + # installed, (b) get compiler path and include directories / libraries. + # FIND_PACKAGE(CUDA) IF(CUDA_FOUND) @@ -96,6 +101,11 @@ ENDMACRO() MACRO(FEATURE_CUDA_CONFIGURE_EXTERNAL) + # + # Ensure that we enable CMake-internal CUDA support with the right + # compiler: + # + SET(CMAKE_CUDA_COMPILER "${CUDA_NVCC_EXECUTABLE}") ENABLE_LANGUAGE(CUDA) # diff --git a/cmake/modules/FindCUDA.cmake b/cmake/modules/FindCUDA.cmake index 4a30f6f3fa..a093d6e0d8 100644 --- a/cmake/modules/FindCUDA.cmake +++ b/cmake/modules/FindCUDA.cmake @@ -19,8 +19,9 @@ # This module exports: # # CUDA_FOUND -# CUDA_LIBRARIES # CUDA_INCLUDE_DIRS +# CUDA_LIBRARIES +# CUDA_NVCC_EXECUTABLE # CUDA_VERSION # CUDA_VERSION_MAJOR # CUDA_VERSION_MINOR -- 2.39.5