Skip to content

Can't find CUDA on Windows in default locations even when nvcc.exe is on the PATH

Hi! I tried to create a CUDA project on Windows.

Running the following CMake file leads to an error:

project(TestEnableCUDA LANGUAGES CUDA)
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.14393.0 to target Windows 10.0.16299.
-- The CUDA compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
  No CMAKE_CUDA_COMPILER could be found.

This is although nvcc.exe is already on the PATH an can be invoked from the same command prompt. This can be worked around by using the CUDACXX environment variable and the CMAKE_CUDA_COMPILER variable, but I believe CMake should be able to find CUDA automatically, especially when it's installed in a default location and on the PATH.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information