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

Robert Maynard robert.maynard at kitware.com
Mon Jun 19 08:23:10 EDT 2017


Hi James,

I have created a bug report for this issue, which you can track at:
https://gitlab.kitware.com/cmake/cmake/issues/16993

On Fri, Jun 16, 2017 at 12:14 PM, Hancox, James <JHancox at tmvse.com> wrote:
> 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
> ______________________________________________________________________
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list