[CMake] Setting compile defs with: Cuda, add_subdirectory, and set_target_properties (COMPILE_DEFINITIONS)

Brian Davis bitminer at gmail.com
Wed Jul 14 16:12:31 EDT 2010


Also strange is I have to change the code:

-snip-
#ifdef gpuPMatrixRecon_EXPORTS
#define DllImportExport   __declspec( dllexport )
#else
#define DllImportExport   __declspec( dllimport )
#endif
-end snip-

to

-snip-
#if defined(gpuPMatrixRecon_EXPORTS) || defined(cpuPMatrixRecon_EXPORTS)
#define DllImportExport   __declspec( dllexport )
#else
#define DllImportExport   __declspec( dllimport )
#endif
-end snip-

Which I would totally expect except the build line for the cpuPMatrixRecon
reads:

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_11 --ptxas-options=-v -maxrregcount=32 -Xcompiler
/EHsc,/W3,/nologo,/Od,/Zi,/MTd -m64 -DCUDADeviceProperties_DLLExport=yes
-DGPU_RECON=yes -DgpuPMatrixRecon_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/gpuPMatrixRecon_generated_gpuPMatrixRecon.cu.obj.NVCC-depend
-IC:/CUDA/include "-IC:/ProgramData/NVIDIA Corporation/NVIDIA GPU Computing
SDK/C/common/inc"
-IC:/Users/bdavis5/Documents/QS/QS-NIH/source/branches/trunk/source/cpp/lib/3rdParty/Win/boost-cmake-1_41_0
-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
....
...
...
2>gpuPMatrixRecon.cpp
2>..\..\..\..\..\..\..\..\..\source\Matlab\lib\3rdParty\Siemens\gpu\PMatrixRecon\gpuPMatrixRecon.cpp(37)
: error C2491: 'gpuPMatrixRecon::recon' : definition of dllimport function
not allowed
2>CUDADeviceProperties.cpp
2>..\..\..\..\..\..\..\..\..\source\Matlab\lib\3rdParty\Siemens\gpu\PMatrixRecon\CUDADeviceProperties.cpp(73)
: warning C4267: 'initializing' : conversion from 'size_t' to 'int',
possible loss of data
2>Generating Code...
2>Build log was saved at
"file://c:\Users\bdavis5\Documents\QS\QS-NIH\source\branches\trunk\build\dvip4-Win64\source\Matlab\lib\3rdParty\Siemens\gpu\PMatrixRecon\cpuPMatrixRecon.dir\Debug\BuildLog.htm"
2>cpuPMatrixRecon - 1 error(s), 41 warning(s)

The weird part?.... no auto define (which CMake does itself) for
-DcpuPMatrixRecon_EXPORTS but instead -DgpuPMatrixRecon_EXPORTS

If I change the code to #if defined(gpuPMatrixRecon_EXPORTS) ||
defined(cpuPMatrixRecon_EXPORTS)  the library compiles even though in the
build line only contains -DgpuPMatrixRecon_EXPORTS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100714/cb708ba2/attachment-0001.htm>


More information about the CMake mailing list