diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake index 1c48159dd3..780e953d08 100644 --- a/Modules/CMakeCUDAInformation.cmake +++ b/Modules/CMakeCUDAInformation.cmake @@ -186,16 +186,25 @@ if(NOT CMAKE_CUDA_LINK_EXECUTABLE) " -o ${__IMPLICT_LINKS}") endif() +if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "8.0.0") + set(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS "-Wno-deprecated-gpu-targets") +else() + set(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS "") +endif() + + #These are used when linking relocatable (dc) cuda code if(NOT CMAKE_CUDA_DEVICE_LINK_LIBRARY) set(CMAKE_CUDA_DEVICE_LINK_LIBRARY - " ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} -shared -dlink -o ") + " ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink -o ") endif() if(NOT CMAKE_CUDA_DEVICE_LINK_EXECUTABLE) set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE - " ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} -shared -dlink -o ") + " ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink -o ") endif() +unset(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS) + mark_as_advanced( CMAKE_CUDA_FLAGS CMAKE_CUDA_FLAGS_RELEASE diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake index 845fa4b6ff..970c2c6d1f 100644 --- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake +++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake @@ -30,10 +30,18 @@ set(CMAKE_CUDA_LINK_EXECUTABLE unset(_CMAKE_VS_LINK_EXE) unset(_CMAKE_VS_LINK_EXE) +if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "8.0.0") + set(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS "-Wno-deprecated-gpu-targets") +else() + set(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS "") +endif() + set(CMAKE_CUDA_DEVICE_LINK_LIBRARY - " -shared -dlink -o -Xcompiler=-Fd,-FS") + " ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink -o -Xcompiler=-Fd,-FS") set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE - " -shared -dlink -o -Xcompiler=-Fd,-FS") + " ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink -o -Xcompiler=-Fd,-FS") + +unset(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS) string(REPLACE "/D" "-D" _PLATFORM_DEFINES_CUDA "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_CXX}") diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 46c289476b..29a06b71a9 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2591,6 +2591,13 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions( cudaLinkOptions.AddFlag("PerformDeviceLink", doDeviceLinking ? "true" : "false"); + // Suppress deprecation warnings for default GPU targets during device link. + if (cmSystemTools::VersionCompareGreaterEq( + this->GlobalGenerator->GetPlatformToolsetCudaString(), "8.0")) { + cudaLinkOptions.AppendFlag("AdditionalOptions", + "-Wno-deprecated-gpu-targets"); + } + this->CudaLinkOptions[configName] = pOptions.release(); return true; }