Merge branch 'msvc-cuda-cccl' into rc173 (MSVC: conforming preprocessor for CUDA sources, as CCCL requires)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D1G8gJVAy6gp1K5Dz3NE5C
This commit is contained in:
leonarski_fandClaude Opus 5.5 committed 2026-09-29 07:12:18 +02:00
commit dfd25c4efb
1 file changed
+9
+9
View File
@@ -28,8 +28,17 @@ SET(CMAKE_CXX_STANDARD_REQUIRED True)
# Catch2 compiles itself with CATCH_CONFIG_DISABLE_EXCEPTIONS. Adding it here, before any
# FetchContent, reaches every C++ target whatever CMAKE_CXX_FLAGS holds. CUDA gets it from its own
# default CMAKE_CUDA_FLAGS, which nothing overrides.
#
# CUDA's CCCL headers (cub, thrust, libcu++) stop with an #error under MSVC's traditional
# preprocessor, which miscompiles their macros. nvcc preprocesses and compiles host code with cl.exe,
# so the standard-conforming preprocessor is switched on for .cu sources here, reaching every CUDA
# target, fetched ones included (VS 2019 16.5 or newer). ffbidx already sets the same for its own
# CUB-using kernel, which is why the other CUDA targets never needed it. C++ sources keep the
# default: none includes a CCCL header, and the switch would change the preprocessing of Qt, the
# Windows SDK and every fetched dependency with nothing to gain.
IF (MSVC)
ADD_COMPILE_OPTIONS($<$<COMPILE_LANGUAGE:CXX>:/EHsc>)
ADD_COMPILE_OPTIONS($<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=/Zc:preprocessor>)
ENDIF()
SET(JFJOCH_WRITER_ONLY OFF CACHE BOOL "Compile HDF5 writer only")