From ef2748a40a6fcd72e652932f4ff647fcf01e6dc6 Mon Sep 17 00:00:00 2001 From: Stanley5249 Date: Mon, 3 Aug 2026 15:25:02 +0800 Subject: [PATCH] fix(cmake): only apply /MP to the MSVC compiler, not icx The MSVC top-level generator/toolset check stays true for mixed `cl`/`icx` SYCL builds (-DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=icx), so the unconditional /MP added in #1438 leaks into the icx CXX compile line. icx rejects /MP once offloading is enabled, breaking every Windows SYCL build. Gate /MP on the per-language compiler ID instead of the generator-level MSVC variable. --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a003f400a..3c2b7b4a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,10 +11,11 @@ endif() if (MSVC) add_compile_definitions(_CRT_SECURE_NO_WARNINGS) add_compile_definitions(_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING) + # /MP is MSVC-only: icx rejects it outright once offloading is enabled. add_compile_options( - $<$:/MP> + $<$,$>:/MP> $<$:/utf-8> - $<$:/MP> + $<$,$>:/MP> $<$:/utf-8> ) endif()