[CMake] Missing <target>_EXPORTS definition in CUDA host compilation

Hancox, James JHancox at tmvse.com
Fri Jun 16 12:14:19 EDT 2017


Hi,

I'm trying out the new CUDA support for Visual Studio generators in Cmake 3.9.0-rc3 (generator Visual Studio 12 2013 Win64), and I think I've found a bug.

Our code defines some DLL-export functions in host code in a .cu file, but it seems that the usual <target>_EXPORTS pre-processor definition is missing for host code compilation invoked from NVCC. We have the usual DLL boilerplate defined in a header like so:

#ifdef example_target_EXPORTS
#define EXAMPLE_TARGET_API _declspec(dllexport)
#else
#define EXAMPLE_TARGET_API _declspec(dllimport)
#endif

However in my .cu file, EXAMPLE_TARGET_API is being expanded to _declspec(dllimport), not _declspec(dllexport) . It would appear that example_target_EXPORTS is not being declared.

Is this intended behaviour, or a bug? If intended behaviour, what is the mechanism I should be using instead?

Many thanks,
James Hancox

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170616/d3220ad9/attachment.html>


More information about the CMake mailing list