title: Using a compiler other than cl.exe in Windows 10 to compile .cu files with nvcc
body: <p>I am trying to use GCC to compile with nvcc as opposed to cl.exe using the command</p>
  <pre><code>nvcc -c -o depthconv_cuda_kernel.o depthconv_cuda_kernel.cu --compiler-bindir &quot;C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin&quot; --allow-unsupported-compiler  -x cu -Xcompiler -fPIC -std c++11 --gpu-architecture=compute_86 --gpu-code=sm_86 -DGPU -I&quot;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/include&quot; -DCUDNN --compiler-options &quot;-DGPU -DCUDNN -fPIC&quot;
  </code></pre>
  <p>Importantly I have set --compiler-bindir to the mingw bin directory, as well
  as used the flag --allow-unsupported-compiler (not sure if that is necessary).</p>
  <p>I need gcc for the command line options std c++11 as well as -fPIC . It seems nvcc is still looking for MSVC's cl.exe, how can I change this so it uses the GCC compiler I need? I get the message:</p>
  <p>Failed to run C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/cl.exe (The system cannot find the file specified.
  ).
  nvcc fatal   : Failed to preprocess host compiler properties.</p>