summaryrefslogtreecommitdiff
path: root/Modules/CMakeDetermineCompilerId.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-03-02 15:45:47 -0500
committerBrad King <brad.king@kitware.com>2022-03-02 15:49:14 -0500
commit5c1f5357b0335158aa7b31990d1df26fd04114f2 (patch)
tree9337d4861aa21f61f24bc0fc1f21fd40bc2d5774 /Modules/CMakeDetermineCompilerId.cmake
parent04a7200c7561509a83c34f2af45b2d091ae59248 (diff)
downloadcmake-5c1f5357b0335158aa7b31990d1df26fd04114f2.tar.gz
VS: Fix CUDA compiler id with CMAKE_CUDA_ARCHITECTURES={all,all-major}
Skip the architecture verification check for these values on Visual Studio. It cannot be implemented correctly until future work delays the check to the main compiler test step. Issue: #23164, #23161
Diffstat (limited to 'Modules/CMakeDetermineCompilerId.cmake')
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake10
1 files changed, 6 insertions, 4 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 3ea146ccae..e0aa483ec0 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -495,10 +495,12 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
if(CMAKE_VS_PLATFORM_NAME STREQUAL x64)
set(cuda_target "<TargetMachinePlatform>64</TargetMachinePlatform>")
endif()
- foreach(arch ${CMAKE_CUDA_ARCHITECTURES})
- string(REGEX MATCH "[0-9]+" arch_name "${arch}")
- string(APPEND cuda_codegen "compute_${arch_name},sm_${arch_name};")
- endforeach()
+ if(NOT CMAKE_CUDA_ARCHITECTURES MATCHES "^(all|all-major)$")
+ foreach(arch ${CMAKE_CUDA_ARCHITECTURES})
+ string(REGEX MATCH "[0-9]+" arch_name "${arch}")
+ string(APPEND cuda_codegen "compute_${arch_name},sm_${arch_name};")
+ endforeach()
+ endif()
set(id_ItemDefinitionGroup_entry "<CudaCompile>${cuda_target}<AdditionalOptions>%(AdditionalOptions)-v</AdditionalOptions><CodeGeneration>${cuda_codegen}</CodeGeneration></CudaCompile>")
set(id_PostBuildEvent_Command [[echo CMAKE_CUDA_COMPILER=$(CudaToolkitBinDir)\nvcc.exe]])
if(CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR)