summaryrefslogtreecommitdiff
path: root/Modules/CMakeCUDAInformation.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-04-07 09:50:10 -0400
committerBrad King <brad.king@kitware.com>2021-04-07 10:54:27 -0400
commit8e38985db7cb2c66f7fe74919e03e3f3ae0d0c41 (patch)
tree2972c651e48e5055eaf834b044575714d3edb5a6 /Modules/CMakeCUDAInformation.cmake
parentf8af94a2124d61e33f71f67b4ae282475314da25 (diff)
downloadcmake-8e38985db7cb2c66f7fe74919e03e3f3ae0d0c41.tar.gz
Makefiles: Fix dependency extraction with CUDA < 10.2 and host compiler
Since commit 2c71d051fa (Makefiles Generators: use compiler for dependencies generation, 2020-10-18, v3.20.0-rc1~392^2) we invoke `nvcc` for CUDA < 10.2 a second time in order to generate a depfile. When `CMAKE_CUDA_HOST_COMPILER` is set, the second invocation is missing its `-ccbin=` option, even after refactoring in commit 8981e3e7cc (NVIDIA-CUDA: rely on new capabilities for deps generation, 2020-12-02, v3.20.0-rc1~362^2). Ideally we should move the `-ccbin=` flag into `Compiler/NVIDIA-CUDA`, but that will add `CMAKE_CUDA_HOST_COMPILER` support on Windows in command-line generators but not the Visual Studio generators. For now, add the flag to the depfile command specifically. Fixes: #22037
Diffstat (limited to 'Modules/CMakeCUDAInformation.cmake')
-rw-r--r--Modules/CMakeCUDAInformation.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake
index cb03ef405b..5fd54c13a8 100644
--- a/Modules/CMakeCUDAInformation.cmake
+++ b/Modules/CMakeCUDAInformation.cmake
@@ -111,6 +111,9 @@ include(CMakeCommonLanguageInclude)
# CMAKE_CUDA_LINK_EXECUTABLE
if(CMAKE_CUDA_HOST_COMPILER AND CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
+ # FIXME: This is too late for the Platform/Windows-NVIDIA-CUDA module to
+ # see it, so we do not support CMAKE_CUDA_HOST_COMPILER on Windows.
+ # Move this to Compiler/NVIDIA-CUDA and update the VS generator too.
string(APPEND _CMAKE_CUDA_EXTRA_FLAGS " -ccbin=<CMAKE_CUDA_HOST_COMPILER>")
endif()