[CMake] Passing -x=cu to FindCUDA, and specifying libraries to nvcc
Irwin Zaid
irwin.zaid at physics.ox.ac.uk
Fri Jan 16 11:25:06 EST 2015
Hi all (and James),
I just have two other quick questions about FindCUDA. Here we go!
1) I have a project that tries to keep all its CUDA code in .cpp files.
I'm currently making this work with a lot of dummy .cu files that simply
include the .cpp, but I'd like to get rid of these.
nvcc does support a -x flag for specifying whether it should treat files
as .c, .cpp, or .cu. However, FindCUDA seems unable to handle this and
things break immediately. Is it because FindCUDA uses the file extension
to determine what action to take?
Is there a way to force FindCUDA to either treat everything as a CUDA
file, or treat specific files as CUDA files?
2) Is there a way to tell FindCUDA that a library needs to be linked in
nvcc? What I have is a library built with nvcc that should go through
the device linker. If I just pass it to target_link_libraries, then nvcc
doesn't get it and only the host linker does.
Also, I'm in a subproject (think of a test program), and I find that
using NVCC_FLAGS doesn't get it there either. What has worked is simply
passing it as an option to cuda_add_executable, but that feels a little raw.
Thanks all (and James),
Irwin
More information about the CMake
mailing list