Compiling cuda code inside a cpp file without nvcc

Hi,

I have a library that uses the nvidia cuda runtime API and the driver API. All the files are saved as .cc and .h instead of .cuh and .cu (Reason: I wanted to test if I can bypass the CMake check for a cuda compiler on non GPU devices)

If I build the file with cmake without specifying language as cuda and link the CUDA::cudart
CUDA::cuda_driver it still compiles and runs successfully.

The files don’t have any kernels etc. Use only cuda api calls like cuMemAlloc etc.

How does it compile and run without explicitly stating the compile language as CUDA and saving the files as .cu/.cuh?