In FindCUDA source code, I found the ability to activate CUDA compilation for certain non .cu
. Although it seems that the documentation is not enough (outside the source code).
You can configure file-level CUDA compilation with
set_source_files_properties( foo.cpp PROPERTIES CUDA_SOURCE_PROPERTY_FORMAT OBJ )
in CMAKE 3.3 or later.
The rest works as usual:
cuda_add_executable(foo foo.cpp)
Actually, I expected that there should be a simple solution, for example, to use CUDA_NVCC_FLAGS
or cuda_add_executable( ... OPTIONS --x=cu )
to pass the flag --x=cu
. Unfortunately, it does not work. The reason is probably because the installation area at this level will not be useful, as it will affect all files.
source share