FindCUDA does not pick up target properties from SET_PROPERTY
With CMake, it is common to set properties of targets using SET_PROPERTY
. This is done after calling ADD_EXECUTABLE
or ADD_LIBRARY
can e.g. be include directories, macro definitions, compilation flags, etc. However, the CUDA equivalents (CUDA_ADD_EXECUTABLE
and CUDA_ADD_LIBRARY
) does not work with these.
For example, if I do something like this,
ADD_EXECUTABLE(myprog myprog.cpp)
SET_PROPERTY(TARGET myprog APPEND PROPERTY
COMPILE_DEFINITIONS "DEF1;DEF2"
)
then the two macros DEF1
and DEF2
will be defined at compilation.
However, if I switch to the corresponding CUDA setup,
CUDA_ADD_EXECUTABLE(myprog myprog.cu)
SET_PROPERTY(TARGET myprog APPEND PROPERTY
COMPILE_DEFINITIONS "DEF1;DEF2"
)
then they are not defined.
Although something similar can be achieved in other ways, e.g. by using INCLUDE_DIRECTORIES
before calling CUDA_ADD_EXECUTABLE
, this makes it very difficult to handle a large complex library where one has several versions of the same target with different configuration (e.g. debug and release). Any temporary fix which lets us set properties of targets would be much appreciated, but I believe FindCUDA should really be fixed to support this.