summaryrefslogtreecommitdiffstats
path: root/Modules/FindCUDA.cmake
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@fb.com>2018-04-04 19:07:16 (GMT)
committerBrad King <brad.king@kitware.com>2018-04-06 15:21:34 (GMT)
commit2da36984475678858885ab35c2711726c710f4e1 (patch)
treef9764ff67bb01b54fde59a93319c01abc1a34428 /Modules/FindCUDA.cmake
parent3201e4c156fcf79a7c29a73430e72b1bcd43cedc (diff)
downloadCMake-2da36984475678858885ab35c2711726c710f4e1.zip
CMake-2da36984475678858885ab35c2711726c710f4e1.tar.gz
CMake-2da36984475678858885ab35c2711726c710f4e1.tar.bz2
FindCUDA: Add support for clcache
When `CMAKE_C_COMPILER` is `clcache`, pass plain `cl` as the host compiler to `nvcc`. Otherwise, `nvcc` does not accept it. Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Diffstat (limited to 'Modules/FindCUDA.cmake')
-rw-r--r--Modules/FindCUDA.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 6f6f349..a0e4aa9 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -557,6 +557,11 @@ else()
set(c_compiler_realpath "")
endif()
set(CUDA_HOST_COMPILER "${c_compiler_realpath}" CACHE FILEPATH "Host side compiler used by NVCC")
+ elseif(MSVC AND "${CMAKE_C_COMPILER}" MATCHES "clcache")
+ # NVCC does not think it will work if it is passed clcache.exe as the host
+ # compiler, which means that builds with CC=cl.exe won't work. Best to just
+ # feed it whatever the actual cl.exe is as the host compiler.
+ set(CUDA_HOST_COMPILER "cl.exe" CACHE FILEPATH "Host side compiler used by NVCC")
else()
set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}"
CACHE FILEPATH "Host side compiler used by NVCC")