From ace1664135ec9e937c05ada9e7a8adde0f9b0f87 Mon Sep 17 00:00:00 2001 From: Mario Emmenlauer Date: Mon, 4 May 2026 19:56:44 +0200 Subject: [PATCH] Improvements for MSVC and Clang-Cl compiler warnings on Windows --- cmake/HighFiveWarnings.cmake | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/cmake/HighFiveWarnings.cmake b/cmake/HighFiveWarnings.cmake index 2357a97c..e01b28e3 100644 --- a/cmake/HighFiveWarnings.cmake +++ b/cmake/HighFiveWarnings.cmake @@ -13,7 +13,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" target_compile_options(HighFiveWarnings INTERFACE - -Wall -Wextra -Wshadow -Wnon-virtual-dtor @@ -23,6 +22,21 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" -Wconversion -Wsign-conversion ) + + # Clang-Cl frontend for Microsoft Compiler does not digest -Wall because it + # enables some obscure warnings about missing c++98 compatibility. Better is + # to use Microsoft-style /W4 flag: + if(NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + target_compile_options(HighFiveWarnings + INTERFACE + -Wall + ) + else() + target_compile_options(HighFiveWarnings + INTERFACE + /W4 + ) + endif() endif() if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") @@ -46,4 +60,3 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") ) endif() endif() -