[CMake] No mechanism to set -Xcompiler options with Visual Studio CUDA integration?

Hancox, James JHancox at tmvse.com
Wed Jun 21 09:08:30 EDT 2017


Hi all,

I'm trying out the CMake 3.9.0-rc3 support for CUDA with Visual Studio generators*, and trying to port over an existing project that uses FindCUDA. I'm sure I'm missing something obvious, but I can't see any mechanism to set -Xcompiler flags.

To be more explicit, I need to set /bigobj on the host compiler for a .cu file. If I use the CUDA Visual Studio Integration GUI, I can do this through CUDA C/C++->Host->Additional Compiler Options, which populates the CudaCompile\AdditionalCompilerOptions section of the .vcxproj. At compile time any flags in this field are passed to nvcc by the -Xcompiler flag, which in turn passes them through to the host compiler.

Unfortunately I cannot find any way to achieve this through CMake. I have tried to add it to CMAKE_CUDA_FLAGS like so:

set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler \"/bigobj\"")

But the generated .vcxproj does not have any trace of this line in it. (This method does work for setting -Xcudafe parameters as expected, but it almost seems like -Xcompiler flags are being deliberately stripped out.)

Is there some other mechanism for passing parameters into -Xcompiler?

Best wishes,
James Hancox


*To be precise, I'm using Visual Studio 12 2013 Win64 generator, CUDA 8.0.61 and CMake 3.9.0-rc3.


______________________________________________________________________
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/20170621/8b8a80da/attachment.html>


More information about the CMake mailing list