From 17113ea87e425b153dec29f17b88c93995851d87 Mon Sep 17 00:00:00 2001 From: Shawn Zeng Date: Wed, 7 Jan 2026 15:32:34 +0800 Subject: [PATCH] Bug 5701423: Add MSVC-specific flag /Zc:preprocessor as CCCL change the warning of this flag to error --- CHANGELOG.md | 3 +++ CMakeLists.txt | 5 +++++ Samples/2_Concepts_and_Techniques/particles/CMakeLists.txt | 5 +---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c1f791d..784a15a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## Changelog +### CUDA 13.2 +* Added the MSVC compile flag `-Xcompiler=/Zc:preprocessor` in CMakeLists.txt to comply with CUDA13.2 CCCL. Previously, using the traditional preprocessor triggered the warning “MSVC/cl.exe with traditional preprocessor is used…”, which now leads to a build error. + ### CUDA 13.1 * Minor bug fixes and enhancements, no structural or functional changes diff --git a/CMakeLists.txt b/CMakeLists.txt index 92e580e2..49d69f9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,11 @@ endif() set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --extended-lambda") +# Add MSVC-specific flags for standard-conforming preprocessor (required for CCCL) +if(MSVC) + add_compile_options($<$:-Xcompiler=/Zc:preprocessor>) +endif() + # Include installation configuration before processing samples include(cmake/InstallSamples.cmake) diff --git a/Samples/2_Concepts_and_Techniques/particles/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/particles/CMakeLists.txt index 7441b7d8..f81cb309 100644 --- a/Samples/2_Concepts_and_Techniques/particles/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/particles/CMakeLists.txt @@ -39,10 +39,7 @@ if(${OpenGL_FOUND}) # Add target for particles add_executable(particles particleSystem.cpp particleSystem_cuda.cu particles.cpp render_particles.cpp shaders.cpp) -target_compile_options(particles PRIVATE - $<$:--extended-lambda> - $<$,$>:-Xcompiler="/Zc:preprocessor"> -) +target_compile_options(particles PRIVATE $<$:--extended-lambda>) target_compile_features(particles PRIVATE cxx_std_17 cuda_std_17)