From 2b0d3c3524fd96c17520cac766205bed333666b1 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Sun, 25 Oct 2020 14:08:55 -0400 Subject: CUDA: Use MSVC version to determine supported C++ standard levels Fixes: #21335 --- Modules/Compiler/NVIDIA-CUDA.cmake | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake index 7c24373..1a724a0 100644 --- a/Modules/Compiler/NVIDIA-CUDA.cmake +++ b/Modules/Compiler/NVIDIA-CUDA.cmake @@ -78,13 +78,20 @@ if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_CUDA11_EXTENSION_COMPILE_OPTION "") if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0) - set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "-std=c++14") - set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "-std=c++14") + if(CMAKE_CUDA_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.10.25017) + set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "-std=c++14") + set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "-std=c++14") + else() + set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "") + set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "") + endif() endif() if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 11.0) - set(CMAKE_CUDA17_STANDARD_COMPILE_OPTION "-std=c++17") - set(CMAKE_CUDA17_EXTENSION_COMPILE_OPTION "-std=c++17") + if(CMAKE_CUDA_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.11.25505) + set(CMAKE_CUDA17_STANDARD_COMPILE_OPTION "-std=c++17") + set(CMAKE_CUDA17_EXTENSION_COMPILE_OPTION "-std=c++17") + endif() endif() else() -- cgit v0.12