Is it exlicitly described in the doc that Modern CMake will only compile `.cu` files with `nvcc`?

Hi, guys,
I am a learner of CMake, and I find that CMake would only compile .cu files with nvcc, except any files with the other extensions.
Is this rule exlicitly described in the CMake documentation?
Currently, I have not been able to find relevant content.

Your answer and sharing will be appreciated!

@robert.maynard

1 Like

.cu files by default are mapped to the CUDA language. CMake supports compiling CUDA sources with either nvcc and clang which is documented at: https://cmake.org/cmake/help/latest/manual/cmake-compile-features.7.html

If you want to compile a .cu file as a C++ source you would set the LANGUAGE source file property to CXX.

1 Like

Thanks sincerely for your guidance!