James I was going to cc you on my latest findings. Thanks for giving me a "way out" with out having to patch the FindCUDA. I recently came to the same conclusion as your recent post.<br><br>1. CUDA_ATTACH_VS_BUILD_RULE_TO_<div>
CUDA_FILE can really only cause problems with parallel builds. Are you performing parallel builds?<br><br>No I am not<br><br>2. Have you tried to disable this flag? </div><br>Yes I have and it turns out I must in order for me to get my .cu file to be compiled with correct -DDefines. <br>
<br>I also did as you suggested above though I wish I would have looked at my email sooner as I ended up coming to the same conclusion.<br><br>first it appears I must remove<br>--snip--<br> foreach( DEFINE_STR ${ARG_DEFINES} )<br>
message( "DEFINE_STR = ${DEFINE_STR}" )<br> add_definitions( -D${DEFINE_STR} )<br> endforeach()<br>--end snip--<br><br>and change as you stated:<br><br>--snip--<br> CUDA_ADD_LIBRARY( ${LIB_NAME} SHARED ${MATLAB_CUDA_FILES} <span style="background-color: rgb(255, 255, 102);">OPTIONS ${my_nvcc_flags}</span> )<br>
--end snip<br><br>to <br><br>-snip-- <br><br>if(DEFINED ARG_CU_SOURCES )<br> message("\tARG_CU_SOURCES is defined as = ${ARG_CU_SOURCES}" )<br> CUDA_ADD_LIBRARY( ${LIB_NAME} SHARED ${MATLAB_CUDA_FILES} <br>
OPTIONS <br> DEBUG ${DEFINITIONS_STRING}<br> RELEASE ${DEFINITIONS_STRING}<br> MINSIZEREL ${DEFINITIONS_STRING}<br> RELWITHDEBINFO ${DEFINITIONS_STRING}<br>
)<br> else()<br>--end snip--<br><br>as <br><br>--snip from FindCuda.cmake--<br>macro(CUDA_PARSE_NVCC_OPTIONS _option_prefix)<br> set( _found_config )<br> foreach(arg ${ARGN})<br> # Determine if we are dealing with a perconfiguration flag<br>
foreach(config ${CUDA_configuration_types})<br> string(TOUPPER ${config} config_upper)<br> if (arg STREQUAL "${config_upper}")<br> set( _found_config _${arg})<br>message( "_found_config = ${_found_config}" ) <br>
# Set arg to nothing to keep it from being processed further<br> set( arg )<br> endif()<br> endforeach()<br><br> if ( arg )<br> list(APPEND ${_option_prefix}${_found_config} "${arg}")<br>
endif()<br> endforeach()<br>endmacro()<br>--end snip--<br><br>searches for DEBUG, RELEASE, ... etc to append to <br><br>which give me the MSVS output I am looking for.<br><br>--snip-- <br>2>C:/CUDA/bin64/nvcc.exe C:/Users/bdavis5/Documents/QS/QS-NIH/source/branches/trunk/source/Matlab/lib/3rdParty/Siemens/gpu/PMatrixRecon/gpuPMatrixRecon.cu -arch sm_13 --ptxas-options=-v -maxrregcount=32 -Xcompiler /EHsc,/W3,/nologo,/Od,/Zi,/MTd -DCUDADeviceProperties_DLLExport=yes -DCPU_RECON=yes -m64 -DcpuPMatrixRecon_EXPORTS -ccbin "c:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin" -DNVCC -M -o C:/Users/bdavis5/Documents/QS/QS-NIH/source/branches/trunk/build/dvip4-Win64/source/Matlab/lib/3rdParty/Siemens/gpu/PMatrixRecon/CMakeFiles/cpuPMatrixRecon_generated_gpuPMatrixRecon.cu.obj.NVCC-depend -IC:/CUDA/include -IC:/Users/bdavis5/Documents/QS/QS-NIH/source/branches/trunk/source/cpp/lib/3rdParty/Win/boost-cmake-1_41_0 "-IC:/ProgramData/NVIDIA Corporation/NVIDIA GPU Computing SDK/C/common/inc" -IC:/Users/bdavis5/Documents/QS/QS-NIH/source/branches/trunk/build/Windows-6.0/install/include/vtk-5.6 -IC:/Users/bdavis5/Documents/QS/QS-NIH/source/branches/trunk/build/Windows-6.0/install/include/VTKEdge "-IC:/Program Files/MATLAB/R2010a/extern/include" -IC:/Users/bdavis5/Documents/QS/QS-NIH/source/branches/trunk/source/Matlab/lib/3rdParty/Siemens/gpu/PMatrixRecon/. -IC:/CUDA/include<br>
2>gpuPMatrixRecon.cu<br>--end snip--<br><br>Note no more -DGPU_RECON ... Yippie!!!<br><br>in response to:<br><br>--snip--<br>FindCUDA.cmake can't use the target properties, because target
properties can be set anytime, and the FindCUDA.cmake script needs the
properties at the time cuda_add_libraries is called. This is because
FindCUDA.cmake generates build scripts at configure time and not at
generate time.<br>--end snip--<br><br>Yes I noticed this when looking, debugging, testing FindCuda. It is the infamous chicken-in-egg problem. get_target_properties can't be used in the FindCuda.cmake script (I tried modifying it) as I cannot call set_target_properties before calling CUDA_ADD_LIBRARY as the target does not exist until after this call.<br>
<br><br>I appreciate the help and hope this helps someone else<br>