I have a project that I am just starting to use CLion on. The existing CMakeLists.txt file contains the following lines:
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(myProj LANGUAGES C CXX CUDA)
I have the Cuda 8.0 dev tools installed. Loading the CMake project from within CLion gives the following error:
/home/ubuntu/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/181.4668.70/bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /home/ubuntu/myProj
CMake Error at CMakeLists.txt:2 (project):
No CMAKE_CUDA_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CUDACXX" or the CMake cache entry CMAKE_CUDA_COMPILER to the full
path to the compiler, or to the compiler name if it is in the PATH.
But cuda and its compiler, nvcc, is installed and in the path. I can bring up a terminal (bash) window from within CLion and run the Cuda compiler:
$ which nvcc
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Sun_Sep__4_22:14:01_CDT_2016
Cuda compilation tools, release 8.0, V8.0.44
I've tried setting CUDA_CXX in the environment to the full path of the nvcc compiler, the path of the directory it resides in, just "nvcc", no improvement.
I *CAN* get it to work by adding:
to the CMakeLists.txt file, but other people need to be able to build this project, including our automated build system, where the path to the nvcc compiler might be different, so I don't want a hard-coded path in the make file.
Running cmake from outside CLion, as in:
$ cmake ..
also works fine WITHOUT setting CMAKE_CUDA_COMPILER in the CMakeLists.txt file. One difference here is that the cmake in my search path is version 3.11.1, whereas the cmake version CLion is using is 3.10.3, but I know that isn't the issue because:
$ /home/ubuntu/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/181.4668.70/bin/cmake/bin/cmake ..
also works fine.
Why isn't the CLion CMake able to find the Cuda compiler?
Thanks in advance.
Build #CL-181.4668.70, built on April 24, 2018
JRE: 1.8.0_152-release-1136-b29 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o