CLion can't find nvcc when installed from conda

34 Views Asked by At

I installed cuda toolkit, which includes nvcc, using the official Nvidia conda repo.

It works when I manually invoke nvcc on terminal, but when I create a Cuda project in CLion, on startup of the project I get

Failed to find nvcc.

  Compiler requires the CUDA toolkit.  Please set the CUDAToolkit_ROOT
  variable.

Makes sense; it's not in my path, so I go to CMakeLists.txt tab in CLion and put set(CMAKE_CUDA_COMPILER "/home/xdavidliu/.conda/envs/foo-conda-env/bin/nvcc"). However, nothing changes; still same error message. What am I doing wrong?

1

There are 1 best solutions below

0
xdavidliu On

I needed to go to Settings -> Build, Execution, Deps -> CMake, then under CMake options, put

-DCMAKE_CUDA_COMPILER=/home/xdavidliu/.conda/envs/foo-conda-env/bin/nvcc

Then it worked.

Probably related to this