title: CUDA C++ problems with CMake on CLion IDE
body: <p>I'm trying to start a project with CUDA C++ using CLion as an IDE.
  I installed a fresh version of CUDA Developer Tools (v10.2) and tried to load the changes of the MakeFile.
  Apparently, the CUDA compiler (nvcc) doesn't get properly linked, but I'm not sure this is the problem.</p>
  
  <p>This is my CMakeLists.txt:</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.15)
  project(test_cuda LANGUAGES CXX CUDA)
  find_package(CUDA)
  
  set(CMAKE_CXX_STANDARD 17)
  
  add_executable(test_cuda main.cu)
  </code></pre>
  
  <p>The result I get is the following:</p>
  
  <pre><code>"E:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - NMake Makefiles" &lt;path_to_project&gt;\test_cuda
  -- The CUDA compiler identification is NVIDIA 10.2.89
  -- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2/bin/nvcc.exe
  -- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2/bin/nvcc.exe -- broken
  CMake Error at E:/Program Files/JetBrains/CLion 2019.2.5/bin/cmake/win/share/cmake-3.15/Modules/CMakeTestCUDACompiler.cmake:46 (message):
    The CUDA compiler
  
      "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2/bin/nvcc.exe"
  
    is not able to compile a simple test program.
  
    It fails with the following output:
  
      Change Dir: &lt;path_to_project&gt;/test_cuda/cmake-build-debug-visual-studio/CMakeFiles/CMakeTmp
  
      Run Build Command(s):nmake /nologo cmTC_5cf15\fast &amp;&amp;   "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f CMakeFiles\cmTC_5cf15.dir\build.make /nologo -L                  CMakeFiles\cmTC_5cf15.dir\build
      Building CUDA object CMakeFiles/cmTC_5cf15.dir/main.cu.obj
          C:\PROGRA~1\NVIDIA~2\CUDA\v10.2\bin\nvcc.exe    -D_WINDOWS -Xcompiler=" /GR /EHsc"  -Xcompiler="-Zi -Ob0 -Od /RTC1" -Xcompiler=-MDd -x cu -c &lt;path_to_project&gt;\test_cuda\cmake-build-debug-visual-studio\CMakeFiles\CMakeTmp\main.cu -o CMakeFiles\cmTC_5cf15.dir\main.cu.obj -Xcompiler=-FdCMakeFiles\cmTC_5cf15.dir\,-FS
      main.cu
      Linking CUDA executable cmTC_5cf15.exe
          "E:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_5cf15.dir --rc=C:\PROGRA~2\WI3CF2~1\8.1\bin\x86\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\8.1\bin\x86\mt.exe --manifests  -- C:\PROGRA~2\MICROS~1.0\VC\bin\link.exe /nologo "CMakeFiles\cmTC_5cf15.dir\main.cu.obj"  @&lt;path_to_appdata&gt;\Local\Temp\nm8647.tmp
      LINK Pass 1: command "C:\PROGRA~2\MICROS~1.0\VC\bin\link.exe /nologo CMakeFiles\cmTC_5cf15.dir\main.cu.obj /out:cmTC_5cf15.exe /implib:cmTC_5cf15.lib /pdb:&lt;path_to_project&gt;\test_cuda\cmake-build-debug-visual-studio\CMakeFiles\CMakeTmp\cmTC_5cf15.pdb /version:0.0 /machine:X86 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib -LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2/lib/x64 cudadevrt.lib cudart_static.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_5cf15.dir/intermediate.manifest CMakeFiles\cmTC_5cf15.dir/manifest.res" failed (exit code 1112) with the following output:
      CMakeFiles\cmTC_5cf15.dir\main.cu.obj : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
      NMAKE : fatal error U1077: '"E:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe"' : return code '0xffffffff'
      Stop.
      NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"' : return code '0x2'
      Stop.
  
  
    CMake will not be able to correctly generate this project.
  Call Stack (most recent call first):
    CMakeLists.txt:2 (project)
  
  
  -- Configuring incomplete, errors occurred!
  See also "&lt;path_to_project&gt;/test_cuda/cmake-build-debug-visual-studio/CMakeFiles/CMakeOutput.log".
  See also "&lt;path_to_project&gt;/test_cuda/cmake-build-debug-visual-studio/CMakeFiles/CMakeError.log".
  [Finished]
  </code></pre>
  
  <p>Where I substitute the path to the project folder with <code>&lt;path_to_project&gt;</code>.</p>
  
  <p>The .cu file is just a simple hello world source file for now, since I'm trying to solve the issue with the CUDA compiler first.</p>
  
  <p>I can't really find any way to solve this.</p>
  
  <p>Thank you a lot in advance.</p>