Support CUDA 13

The Thrust and CCCL headers shipped with CUDA 13 require at least C++17
and, when the host compiler is MSVC, its standard conforming
preprocessor. The CUDA kernels previously requested a C++ standard that
does not apply to CUDA sources and therefore compiled with the host
compiler default, which is C++14 for MSVC.

Request C++17 for the CUDA kernels and enable the conforming
preprocessor for MSVC hosts starting with CUDA 13.

Change-Id: Iaa5862a40c24a070c8cb033491b8a67da569460a
diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt
index 961e661..cc757d5 100644
--- a/internal/ceres/CMakeLists.txt
+++ b/internal/ceres/CMakeLists.txt
@@ -140,10 +140,15 @@
   set_source_files_properties(cuda_kernels_vector_ops.cu.cc PROPERTIES LANGUAGE CUDA)
   set_source_files_properties(cuda_kernels_bsm_to_crs.cu.cc PROPERTIES LANGUAGE CUDA)
   add_library(ceres_cuda_kernels STATIC cuda_kernels_vector_ops.cu.cc cuda_kernels_bsm_to_crs.cu.cc)
-  target_compile_features(ceres_cuda_kernels PRIVATE cxx_std_14)
+  # CUDA 13 Thrust headers require at least C++17.
+  target_compile_features(ceres_cuda_kernels PRIVATE cuda_std_17)
   target_compile_definitions(ceres_cuda_kernels PRIVATE CERES_STATIC_DEFINE)
   # Enable __host__ / __device__ annotations in lambda declarations
   target_compile_options(ceres_cuda_kernels PRIVATE --expt-extended-lambda)
+  if (MSVC AND CUDAToolkit_VERSION VERSION_GREATER_EQUAL "13.0")
+    # CUDA 13 CCCL headers require MSVC's standard conforming preprocessor.
+    target_compile_options(ceres_cuda_kernels PRIVATE -Xcompiler=/Zc:preprocessor)
+  endif (MSVC AND CUDAToolkit_VERSION VERSION_GREATER_EQUAL "13.0")
   target_include_directories(ceres_cuda_kernels PRIVATE  ${Ceres_SOURCE_DIR}/include  ${Ceres_SOURCE_DIR}/internal ${Ceres_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR})
   list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ceres_cuda_kernels)
 endif (_Ceres_FEATURE_CUDA)