[vtkusers] CMake, UseVTK.cmake and CUDA incompatibility
cory.quammen at kitware.com
Sun Jun 26 05:53:45 EDT 2016
The best way I have found to build a project that uses CUDA and VTK is to:
- make sure the CUDA code is compiled into a separate library target
- clear out the include directories and compiler definitions prior to
specifying the CUDA library target to avoid problems with spaces in
the VTK definitions and too-long command lines
- link you application against the CUDA library and VTK
In your CMakeLists.txt file in the directory for the CUDA library, the
library target set up would look something like this:
# Reset the include directories to avoid an error from the number of
/I -I options
# making the command line for nvcc too long.
set_directory_properties( PROPERTIES INCLUDE_DIRECTORIES "" )
# The definitions (-DFOO) from VTK were confusing nvcc
set_directory_properties( PROPERTIES COMPILE_DEFINITIONS "" )
Hope that helps,
On Sun, Jun 26, 2016 at 11:13 AM, Andreas Hermann <squelsh at gmx.net> wrote:
> Hi everyone,
> I am new to the list, but I already found several postings here that
> describe the same problem. Unfortunately no satisfying answer was given yet
> I am trying to compile a larger project that uses CUDA and PCL (invoking
> But a bunch of CMAKE Flags defined by VTK kill NVCCs parsing, as they
> include spaces.
> Result is:
> "nvcc fatal : A single input file is required for a non-link phase when an
> outputfile is specified"
> Those flags are not required when calling NVCC but VTK defines them globally
> Gregory Kramida describes the problem best in his mail from Dec 2015:
> So my question is: How do you use CUDA together with VTK in a CMake project?
> It would be great to get any advice on how to handle this...
> Powered by www.kitware.com
> Visit other Kitware open-source projects at
> Please keep messages on-topic and check the VTK FAQ at:
> Search the list archives at: http://markmail.org/search/?q=vtkusers
> Follow this link to subscribe/unsubscribe:
More information about the vtkusers