I\'m writing some code that can be compiled as C++ or as CUDA. In the latter case, it makes use of CUDA kernels, in the former it just runs conventional code.
Havin
By default, CMake chooses compiler for a source file according to the file's extension. But you may force CMake to use the compiler you want by setting LANGUAGE property for a file:
set_source_files_properties(test.cpp PROPERTIES LANGUAGE CUDA)
(This just calls CUDA compiler for a file using normal compiler options. You still need to pass additional options for that compiler, so it could work with the unusual file's extension.)