title: NVCC can't handle nested quotes in MSVC compiler options
body: <p>I'm using the following configuration: CUDA 11.4, CMake 3.21.3, Visual Studio 16.11.5, Windows 10.</p>
  <p>I've used CMake to successfully generate a VS2019 solution. Here's the CMakeLists.txt file in its entirety (<a href="https://github.com/robertmaynard/code-samples/tree/master/posts/cmake" rel="nofollow noreferrer">also found here</a>):</p>
  <pre><code>cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
  project(cmake_and_cuda LANGUAGES CXX CUDA)
  
  include(CTest)
  
  add_library(particles STATIC
    randomize.cpp
    randomize.h
    particle.cu
    particle.h
    v3.cu
    v3.h
    )
  
  # Request that particles be built with -std=c++11
  # As this is a public compile feature anything that links to particles
  # will also build with -std=c++11
  target_compile_features(particles PUBLIC cxx_std_11)
  
  # We need to explicitly state that we need all CUDA files in the particle
  # library to be built with -dc as the member functions could be called by
  # other libraries and executables
  set_target_properties( particles
                         PROPERTIES CUDA_SEPARABLE_COMPILATION ON
                        )
  
  if(BUILD_TESTING)
  
    add_executable(particle_test test.cu)
  
    set_target_properties(particle_test PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
    target_link_libraries(particle_test PRIVATE particles)
  
    add_test(NAME particles_10k COMMAND particle_test 10000 )
    add_test(NAME particles_256k COMMAND particle_test 256000 )
  
    if(APPLE)
      # We need to add the default path to the driver (libcuda.dylib) as an rpath,
      # so that the static cuda runtime can find it at runtime.
      set_property(TARGET particle_test PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
    endif()
  endif()
  </code></pre>
  <p>When I try to build the solution, it fails. Looking at the output, I get the following error: <code>nvcc fatal   : A single input file is required for a non-link phase when an outputfile is specified</code>. This is one of the nvcc commands it tried to run:</p>
  <pre><code>&quot;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin\nvcc.exe&quot;
  -gencode=arch=compute_52,code=\&quot;compute_52,compute_52\&quot;
  -gencode=arch=compute_52,code=\&quot;sm_52,compute_52\&quot;
  --use-local-env
  -ccbin &quot;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64&quot;
  -x cu
  -rdc=true
  -I&quot;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\include&quot;
  --keep-dir x64\Debug
  -maxrregcount=0
  --machine 64
  --compile
  -cudart static
  -std=c++14
  -Xcompiler=&quot;/EHsc -Zi -Ob0&quot; -g  -D_WINDOWS -D&quot;CMAKE_INTDIR=\&quot;Debug\&quot;&quot;
  -D_MBCS -DWIN32 -D_WINDOWS -D&quot;CMAKE_INTDIR=\&quot;Debug\&quot;&quot;
  -Xcompiler &quot;/EHsc /W3 /nologo /Od /Fd&quot;C:\Users\firstname lastname\Documents\Github\code-samples\posts\cmake\build\Debug\particles.pdb&quot; /FS /Zi /RTC1 /MDd /GR&quot;
  -o particles.dir\Debug\particle.obj
  &quot;C:\Users\firstname lastname\Documents\Github\code-samples\posts\cmake\particle.cu&quot;
  </code></pre>
  <p>I can't quite tell, but I think it's having a hard time with the nested quotes in the second <code>-Xcompiler</code> option.</p>
  <p>Is there anything wrong with the CMakeLists.txt file? Does this nvcc command look right? Why does nvcc think I'm trying to give it multiple input files?</p>