cmake generated flags from vtk conflict with nvcc compiler (command line macro definitions with spaces need quotes)
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
I'm using a project that is using cmake to configure both VTK and CUDA.
When I use them separately, everything is fine.
When I use them together, the nvcc compiler is confused by some macro definition flags VTK is generating:
-DvtkRenderingCore_AUTOINIT=4 ( vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL ) -DvtkRenderingVolume_AUTOINIT=1 ( vtkRenderingVolumeOpenGL )
I guess those defines are fine for gcc, but when passed to nvcc it (or the shell) gets confused and thinks the space separated values are additional input files, producing compiler errors like:
nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified
It appears that according to gcc documentation (https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#Preprocessor-Options) These sort of flags should have protection against the shell mis-interpreting them: "If you are invoking the preprocessor from a shell or shell-like program you may need to use the shell's quoting syntax to protect characters such as spaces that have a meaning in the shell syntax."
So it seems like the VTK cmake configuration files would be the place to fix this? (ie change them to use quotes or ticks to protect against mis-interpretation by the shell, which I believe is what is going on here).
However perhaps the problem lies with CMake (maybe it should be generating the ticks or quotes), or perhaps I am mis-interpreting the specification by gcc that macro definitions with spaces don't necessarily need quotes (in which case I guess nvcc is the culprit). If you believe something like that is the case, let me know and I can re-file appropriately (it would help to have some explanation to pass on if you do).
I'm happy to provide a simplified example if that will help, let me know.
I'm actually using VTK 6.1, but the drop down only had 6.0.0