Skip to content

CUDA: Add support for finding nvcc in CUDA_PATH

Tobias Ribizel requested to merge upsj/cmake:fix_ninja_windows_cuda into master

Previously, nvcc needed to be present in PATH or specified by CUDACXX. On Windows with vcpkg, the PATH is heavily modified, which leads to nvcc not being found with the Ninja generator, even though CUDA_PATH is available.

This MR fixes the issue by adding a custom _CMAKE_${lang}_COMPILER_PATHS which can be used to add compiler-specific search paths and is used as the last fall-back before failing.

To test this fix, configure any project using the CUDA language after setting up the vcpkg environment

vcpkg env --triplet=x64-windows
cd ...
cmake -GNinja ..

Note that specifying the triplet is necessary, since otherwise PATH points to the x86 version of cl, which causes the compiler ID step fail. This cost me quite a bit of time to figure out.

Fixes #21908 (closed)

Merge request reports

Loading