Index: cmake/Modules/CompilerRTCompile.cmake =================================================================== --- cmake/Modules/CompilerRTCompile.cmake +++ cmake/Modules/CompilerRTCompile.cmake @@ -21,9 +21,13 @@ string(REPLACE " " ";" global_flags "${CMAKE_C_FLAGS}") endif() # On Windows, CMAKE_*_FLAGS are built for MSVC but we use the GCC clang.exe - # which doesn't support flags starting with "/smth". Replace those with - # "-smth" equivalents. + # so perform any required transformations to ensure that they are accepted. if(MSVC) + # The MSVC warning suppression/promotion flags are meaningless and + # unsupported here so remove them. + string(REGEX REPLACE "/w[de]?[0-9]+(;|$)" "" global_flags "${global_flags}") + + # Replace flags starting with "/smth" with "-smth" equivalents. string(REGEX REPLACE "^/" "-" global_flags "${global_flags}") string(REPLACE ";/" ";-" global_flags "${global_flags}") endif()