[CMake] Adding include directories to generated CUDA files

Karl Ljungkvist karl.ljungkvist at it.uu.se
Wed Apr 20 14:19:39 EDT 2016


Hi all,

I'm working with enabling CUDA support for the Finite Element Method 
library Deal.II, which includes a couple of cmake macros for the user to 
set up their Deal.II application. Inside one of these, I now need to 
correctly configure the include directories for the intermediately 
generated CUDA files.

Specifically, CUDA_WRAP_SRCS sets up rules for all CUDA source files, 
and returns a list of all generated .cu.o files which is then passed to 
ADD_EXECUTABLE (all this happens inside CUDA_ADD_EXECUTABLE). In 
Deal.II, we have until now configured the include directories by setting 
a property on the target application:

SET_PROPERTY(TARGET ${_target} APPEND PROPERTY
   INCLUDE_DIRECTORIES "${DEAL_II_INCLUDE_DIRS}"
   )

Now, this does not propagate to these generated cuda .cu.o files. I 
tried adding a similar call like this, but with ${_target} replaced by 
each of the generated .o files, but then I get this error:

set_property could not find TARGET

So my question is, how can I add include directories to these generated 
.cu.o files ? Adding a INCLUDE_DIRECTORIES before calling CUDA_WRAP_SRCS 
works, but we would prefer to do something that is specific to these 
files and not affect the global scope. Any help is greatly appreciated!

Best regards,
Karl

-- 
Karl Ljungkvist
PhD student

Uppsala University
Dept. of Information Technology
Div. of Scientific Computing
Box 337
SE-751 05 Uppsala, Sweden
Email: karl.ljungkvist at it.uu.se
Phone:  +46 18 471 2967
Mobile: +46 70 2003565



More information about the CMake mailing list