Skip to content

CUDA: Fix CMAKE_CUDA_COMPILER_TOOLKIT_ROOT detection in Visual Studio

Brad King requested to merge brad.king/cmake:cuda-toolkit-vs into master

When using a Visual Studio generator, we do not know the path to CMAKE_CUDA_COMPILER until after the compiler id detection project extracts it. However, based on the VS toolchain configuration we know that the compiler id will be NVIDIA, so use that to drive the CUDA architecture flag logic. After the main compiler id step we know CMAKE_CUDA_COMPILER, so CMAKE_CUDA_COMPILER_TOOLKIT_ROOT can then be computed.

Based on !4920 (merged).

Backport: release

Merge request reports