[CMake] CUDA and CMake - how to set CUDA_NVCC_FLAGS per .cu file?

Crni Gorac cgorac at gmail.com
Thu Sep 13 17:27:42 EDT 2012


As in subject: have project with multiple .cu files, and I need
different nvcc flags used for compiling each specific file
(specifically, it's about appending "--maxrregcount=xx" flag to the
list of common flags, and then building each file with these flags).
I tried with:
set_source_files_properties(source_file.cu PROPERTIES CUDA_NVCC_FLAGS
"${CUDA_NVCC_FLAGS};-maxrregcount=48")

Now, if I check with get_source_property, I can see that
CUDA_NVCC_FLAGS is changed for given file through above command,
however it has no effect on the compilation (as checked by "make
VERBOSE=1" - no mention of "maxrregcount" flag in the output).

Note that source files, like source_file.cu above, are actually
configured from common template file, don't know if this could have
any effect here...

Thanks.


More information about the CMake mailing list