From 69f26d8156fed8e9ef597854ffe343e5671b04b9 Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Thu, 23 May 2024 13:08:04 -0400 Subject: VS: Fix compiler identification of nvcc with unsupported host compiler `nvcc` from CUDA < 12.4 does support the MSVC 14.40.17.10 toolset. Users may specify `CUDAFLAGS=-allow-unsupported-compiler` to bypass the check. However, we do not use arbitrary user-specified flags during compiler identification in the VS generator because escaping them for the `AdditionalOptions` of the `.vcxproj` file requires non-trivial logic that we currently only implement in the C++ generator code. Instead, just always pass `-allow-unsupported-compiler` during CUDA compiler identification in the VS generator. Fixes: #26003 --- Modules/CMakeDetermineCompilerId.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 7d063ed..08de0f9 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -567,7 +567,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} if(CMAKE_VS_PLATFORM_NAME STREQUAL x64) set(cuda_target "<TargetMachinePlatform>64</TargetMachinePlatform>") endif() - set(id_ItemDefinitionGroup_entry "<CudaCompile>${cuda_target}<AdditionalOptions>%(AdditionalOptions)-v</AdditionalOptions></CudaCompile>") + set(id_ItemDefinitionGroup_entry "<CudaCompile>${cuda_target}<AdditionalOptions>%(AdditionalOptions)-v -allow-unsupported-compiler</AdditionalOptions></CudaCompile>") set(id_PostBuildEvent_Command [[echo CMAKE_CUDA_COMPILER=$(CudaToolkitBinDir)\nvcc.exe]]) if(CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR) # check for legacy cuda custom toolkit folder structure -- cgit v0.12