diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -572,7 +572,15 @@ # Warning flags =============================================================== function(cxx_add_warning_flags target) target_compile_definitions(${target} PUBLIC -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) - target_add_compile_flags_if_supported(${target} PRIVATE -Wall -Wextra -W -Wwrite-strings + if (NOT MSVC) + # Don't add -Wall with clang-cl; in cl.exe mode, -Wall (or /Wall) means + # the same as -Weverything in a GCC like driver. + target_add_compile_flags_if_supported(${target} PRIVATE -Wall) + else() + # -W4 is the cl.exe equivalent of -Wall + target_add_compile_flags_if_supported(${target} PRIVATE -W4) + endif() + target_add_compile_flags_if_supported(${target} PRIVATE -Wextra -W -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi) if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")