Update CMakeLists.txt to fix Windows CUDA build

- In the top-level CMakeLists.txt, certain flags are passed to
  disable warnings and increase the maximum size of an object file.
  nvcc cannot handle these flags so we tell CMake to only use them
  for C++ code (and not CUDA code).
- In internal/ceres/CMakeLists.txt, CMake is originally told to link
  the import library cudart.lib when linking CUDA code. By default,
  it seems that Visual Studio will link the static library
  cudart_static.lib when linking CUDA code. So we avoid linking with
  cudart.lib to avoid linking the same library twice.

Change-Id: I1fbf0d7e76d57b4338708757b27f5074722608cb
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c30ae9f..69f55b4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -268,6 +268,7 @@
         CUDA::cudart
         CUDA::cusolver
         CUDA::cusparse)
+      set(CMAKE_CUDA_RUNTIME_LIBRARY NONE)
     else (CUDAToolkit_FOUND)
       message("-- Did not find CUDA, disabling CUDA support.")
       update_cache_variable(USE_CUDA OFF)
@@ -533,30 +534,31 @@
   # [1] https://msdn.microsoft.com/en-us/library/4hwaceh6.aspx
   add_definitions("-D_USE_MATH_DEFINES")
   # Disable signed/unsigned int conversion warnings.
-  add_compile_options("/wd4018" "/wd4267")
+  add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/wd4018>)
+  add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/wd4267>)
   # Disable warning about using struct/class for the same symbol.
-  add_compile_options("/wd4099")
+  add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/wd4099>)
   # Disable warning about the insecurity of using "std::copy".
-  add_compile_options("/wd4996")
+  add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/wd4996>)
   # Disable performance warning about int-to-bool conversion.
-  add_compile_options("/wd4800")
+  add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/wd4800>)
   # Disable performance warning about fopen insecurity.
-  add_compile_options("/wd4996")
+  add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/wd4996>)
   # Disable warning about int64 to int32 conversion. Disabling
   # this warning may not be correct; needs investigation.
   # TODO(keir): Investigate these warnings in more detail.
-  add_compile_options("/wd4244")
+  add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/wd4244>)
   # It's not possible to use STL types in DLL interfaces in a portable and
   # reliable way. However, that's what happens with Google Log and Google Flags
   # on Windows. MSVC gets upset about this and throws warnings that we can't do
   # much about. The real solution is to link static versions of Google Log and
   # Google Test, but that seems tricky on Windows. So, disable the warning.
-  add_compile_options("/wd4251")
+  add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/wd4251>)
 
   # Add bigobj flag otherwise the build would fail due to large object files
   # probably resulting from generated headers (like the fixed-size schur
   # specializations).
-  add_compile_options("/bigobj")
+  add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/bigobj>)
 
   # Google Flags doesn't have their DLL import/export stuff set up correctly,
   # which results in linker warnings. This is irrelevant for Ceres, so ignore