From 7ddc400d6232259e9acc6e09cd77c9a6f758e030 Mon Sep 17 00:00:00 2001 From: Hamza Date: Wed, 8 Jan 2025 12:41:17 +0000 Subject: [PATCH] fix: remove clang-cl compilation warning (#1895) - MP flag only applies to cl, not cl frontends to other compilers (e.g. clang-cl, icx-cl etc). Co-authored-by: dominic <510002+dmah42@users.noreply.github.com> --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f045fcd84..fd6906040 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,7 +147,12 @@ set(CMAKE_CXX_EXTENSIONS OFF) if (MSVC) # Turn compiler warnings up to 11 string(REGEX REPLACE "[-/]W[1-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /MP") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") + + # MP flag only applies to cl, not cl frontends to other compilers (e.g. clang-cl, icx-cl etc) + if(CMAKE_CXX_COMPILER_ID MATCHES MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") + endif() add_definitions(-D_CRT_SECURE_NO_WARNINGS) if(BENCHMARK_ENABLE_WERROR)