cmake: Target-specific preprocessor definitions for CUDA targets seems not to work -


with CUDA 3.0 I'm using Mac OSX 10.6 cmake 2.8.1.

Then I added a CUDA target that needs to be BLOCK_SIZE in order to be compiled in order to do some numbers.

  cuda_add_executable (SimpleTestsCUDA SimpleTests.cu BlockMatrix.cpp Matrix.cpp) set_target_properties (SimpleTestsCUDA properties COMPILE_FLAGS -DBLOCK_SIZE = 3)  

verbose = 1 I have noticed that creating an NVCC w / oo -DBLOCK_SIZE = 3 , resulting in an error, because the code used BLOCK_SIZE , but there is also not defined now I CPU target ( used add_executable (...) ) are using and where it worked .

So now the question: I would if it indicates the CUDA target with How can I find out that limiter to set_target_properties line? Googling around has not helped so far and a solution will be silent ..

I think the best way To do this, adding "Option-DBLOCK_SIZE = 3" to cuda_add_executable. So your line would look like this:

  cuda_add_executable (SimpleTestsCUDA SimpleTests.cu BlockMatrix.cpp Matrix.cpp option -DBLOCK_SIZE = 3)  

or you can can

  set (CUDA_NVCC_FLAGS -DBLOCK_SIZE = 3)  
: already set cuda_add_executable

Comments