Visual Studio Generator does not export CUDA object files with WINDOWS_EXPORT_ALL_SYMBOLS
There seems to be a bug with the WINDOWS_EXPORT_ALL_SYMBOLS feature, CUDA and the Visual Studio Generator.
I have setup a small project demonstrating the issue here:
If this project is built with the Ninja generator everything is fine. However, if we build the same project with the same compiler but with the Visual Studio generator instead the symbols defined in the CUDA files are not exported. The generator object file list does not include the CUDA object files when using the Visual Studio generator whereas the Ninja generator correctly includes them.
Object Files with Visual Studio Generator: objects.txt
Object Files with Ninja Generator: lib.def.objs
To reproduce the issue (you need to install CUDA first):
$ git clone https://github.com/willyd/cmake-windows-export-all-issue $ cd cmake-windows-export-all-issue $ mkdir build_vs $ cd build_vs $ cmake -G"Visual Studio 14 2015 Win64" ..\ $ cmake --build .
This will result in an unresolved external symbol link error since the
sum_gpu symbol is not exported correctly. If we build with Ninja the error goes away.
Can you please fix this or suggest where a patch should be applied in the CMake source code?