mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 03:48:02 +08:00
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
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user