summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler/NVIDIA-CUDA.cmake
diff options
context:
space:
mode:
authorunknown <rmaynard@nvidia.com>2021-04-21 13:51:31 (GMT)
committerBrad King <brad.king@kitware.com>2021-04-22 15:40:46 (GMT)
commit625ef88a92d6632e3efd5ee4d6578bfc77928679 (patch)
treed9c7f1c29ca6f25483b1104ce7ca734226d19ab4 /Modules/Compiler/NVIDIA-CUDA.cmake
parent995be1097c35fd3187d147494156bbfb9da7037f (diff)
downloadCMake-625ef88a92d6632e3efd5ee4d6578bfc77928679.zip
CMake-625ef88a92d6632e3efd5ee4d6578bfc77928679.tar.gz
CMake-625ef88a92d6632e3efd5ee4d6578bfc77928679.tar.bz2
CUDA: Add CMAKE_CUDA_HOST_COMPILER support on Windows non-VS generators
Diffstat (limited to 'Modules/Compiler/NVIDIA-CUDA.cmake')
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake14
1 files changed, 5 insertions, 9 deletions
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index a0f7c05..c2fe42d 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -24,21 +24,17 @@ else()
set(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS "")
endif()
+if(CMAKE_CUDA_HOST_COMPILER AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")
+ string(APPEND _CMAKE_CUDA_EXTRA_FLAGS " -ccbin=<CMAKE_CUDA_HOST_COMPILER>")
+endif()
+
if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89)
# The -MD flag was only added to nvcc in 10.2 so
# before that we had to invoke the compiler twice
# to get header dependency information
set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
else()
- if(CMAKE_CUDA_HOST_COMPILER AND NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
- # FIXME: Move the main -ccbin= flag from CMakeCUDAInformation to
- # a block above, remove this copy, and update the VS generator too.
- set(_CMAKE_CUDA_EXTRA_FLAGS_LOCAL " -ccbin=<CMAKE_CUDA_HOST_COMPILER>")
- else()
- set(_CMAKE_CUDA_EXTRA_FLAGS_LOCAL "")
- endif()
- set(CMAKE_CUDA_DEPENDS_EXTRA_COMMANDS "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS}${_CMAKE_CUDA_EXTRA_FLAGS_LOCAL} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M <SOURCE> -MT <OBJECT> -o <DEP_FILE>")
- unset(_CMAKE_CUDA_EXTRA_FLAGS_LOCAL)
+ set(CMAKE_CUDA_DEPENDS_EXTRA_COMMANDS "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M <SOURCE> -MT <OBJECT> -o <DEP_FILE>")
endif()
set(CMAKE_CUDA_DEPFILE_FORMAT gcc)
if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)