I am trying to create a cuda project using clang-3.9 based on the following documentation . But I want to use cmake to create my project. I already set CMAKE_CC_COMPILER and CMAKE_CXX_COMPILER for clang and clang ++ respectively.
But the problem is that if I use
file(GLOB_RECURSE CUDA_SOURCES "./*.cu")
CUDA_ADD_LIBRARY(Benchmarks_CUDA ${CUDA_SOURCES})
in my CMakeList.txt, then cmake will use the default nvcc compiler. But instead, I want to use clang to compile .cu files.
Instead, if I use
add_library (Benchmarks_CUDA ${CUDA_SOURCES})
then i will get an error
CMake Error: Cannot determine link language for target "Benchmarks_CUDA".
CMake Error: CMake can not determine linker language for target: Benchmarks_CUDA
Can someone tell me how to use cmake to build .cu files using clang.
source
share