https://git.reactos.org/?p=reactos.git;a=commitdiff;h=41bc57ddf07abe2311743…
commit 41bc57ddf07abe23117437b4fa3c8e0369abfba8
Author:     Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Tue Jun 29 10:03:28 2021 +0200
Commit:     Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Fri Jul 23 22:03:48 2021 +0200
    [REACTOS] Silence warnings in 3r-party code
---
 base/applications/mstsc/CMakeLists.txt             |  5 +++++
 base/applications/network/telnet/CMakeLists.txt    |  6 ++++++
 base/services/nfsd/CMakeLists.txt                  |  2 +-
 base/services/tftpd/CMakeLists.txt                 |  5 +++++
 dll/3rdparty/libtirpc/CMakeLists.txt               | 10 +++-------
 dll/directx/wine/CMakeLists.txt                    |  6 ++++++
 dll/win32/avifil32/CMakeLists.txt                  |  5 +++++
 dll/win32/comctl32/CMakeLists.txt                  |  4 +++-
 dll/win32/crypt32/CMakeLists.txt                   |  5 +++--
 dll/win32/dbghelp/CMakeLists.txt                   |  3 ++-
 dll/win32/gdiplus/CMakeLists.txt                   |  6 ++++++
 dll/win32/jscript/CMakeLists.txt                   |  6 ++++++
 dll/win32/kernel32/CMakeLists.txt                  |  5 +++++
 dll/win32/mciseq/CMakeLists.txt                    |  5 ++++-
 dll/win32/mciwave/CMakeLists.txt                   |  5 ++++-
 dll/win32/msi/CMakeLists.txt                       | 10 +++++-----
 dll/win32/msxml3/CMakeLists.txt                    |  3 +++
 dll/win32/netapi32/CMakeLists.txt                  |  5 +++++
 dll/win32/ole32/CMakeLists.txt                     |  6 ++++++
 dll/win32/oleaut32/CMakeLists.txt                  |  6 ++++++
 dll/win32/rpcrt4/CMakeLists.txt                    |  5 +++++
 dll/win32/vbscript/CMakeLists.txt                  |  5 +++++
 dll/win32/windowscodecs/CMakeLists.txt             |  5 +++--
 dll/win32/wininet/CMakeLists.txt                   |  5 +++++
 dll/win32/winmm/CMakeLists.txt                     |  5 +++--
 dll/win32/wintrust/CMakeLists.txt                  |  5 +++++
 dll/win32/xmllite/CMakeLists.txt                   |  5 +++++
 drivers/bluetooth/fbtusb/CMakeLists.txt            |  5 +++++
 drivers/filesystems/btrfs/CMakeLists.txt           |  5 +++++
 drivers/filesystems/ext2/CMakeLists.txt            |  8 ++++----
 drivers/storage/ide/uniata/CMakeLists.txt          |  6 ++++++
 modules/rostests/winetests/riched20/CMakeLists.txt |  4 ----
 sdk/lib/fslib/ext2lib/CMakeLists.txt               |  5 +++++
 33 files changed, 145 insertions(+), 31 deletions(-)
diff --git a/base/applications/mstsc/CMakeLists.txt
b/base/applications/mstsc/CMakeLists.txt
index 87a2df78942..6cede16d5f5 100644
--- a/base/applications/mstsc/CMakeLists.txt
+++ b/base/applications/mstsc/CMakeLists.txt
@@ -38,3 +38,8 @@ set_module_type(mstsc win32gui UNICODE)
 add_importlibs(mstsc user32 gdi32 comctl32 ws2_32 crypt32 secur32 advapi32 shell32 ole32
comdlg32 msvcrt kernel32)
 add_pch(mstsc precomp.h SOURCE)
 add_cd_file(TARGET mstsc DESTINATION reactos/system32 FOR all)
+
+if(MSVC)
+    # Disable warning C4267: 'initializing': conversion from 'size_t' to
'uint16', possible loss of data
+    target_compile_options(mstsc PRIVATE /wd4267)
+endif()
diff --git a/base/applications/network/telnet/CMakeLists.txt
b/base/applications/network/telnet/CMakeLists.txt
index 7bb174f62f2..1af3dfefe26 100644
--- a/base/applications/network/telnet/CMakeLists.txt
+++ b/base/applications/network/telnet/CMakeLists.txt
@@ -25,6 +25,12 @@ add_executable(telnet ${SOURCE} telnet.rc)
 target_link_libraries(telnet cppstl)
 set_target_cpp_properties(telnet WITH_EXCEPTIONS)
+if (MSVC)
+    # C4838: conversion from 'int' to 'SHORT' requires a narrowing
conversion
+    # C4996: 'strnicmp': Deprecated POSIX name, Try _strnicmp instead!
+    target_compile_options(telnet PRIVATE /wd4838 /wd4996)
+endif()
+
 if (NOT MSVC)
     target_compile_definitions(telnet PRIVATE _CRT_NONSTDC_NO_DEPRECATE)
 endif()
diff --git a/base/services/nfsd/CMakeLists.txt b/base/services/nfsd/CMakeLists.txt
index d5f5dbd913c..fdb6f81857a 100644
--- a/base/services/nfsd/CMakeLists.txt
+++ b/base/services/nfsd/CMakeLists.txt
@@ -50,7 +50,7 @@ add_executable(nfsd ${SOURCE} nfsd.rc)
 if(MSVC AND (NOT USE_CLANG_CL))
     # Disable warning C4477 (printf format warnings)
-    remove_target_compile_option(nfsd "/we4477")
+    target_compile_options(nfsd PRIVATE /wd4477)
 else()
     # FIXME: Tons of warnings.
     target_compile_options(nfsd PRIVATE "-w")
diff --git a/base/services/tftpd/CMakeLists.txt b/base/services/tftpd/CMakeLists.txt
index 1790a81dff6..3fa949c31a0 100644
--- a/base/services/tftpd/CMakeLists.txt
+++ b/base/services/tftpd/CMakeLists.txt
@@ -4,6 +4,11 @@ set_module_type(tftpd win32cui)
 add_importlibs(tftpd advapi32 ws2_32 iphlpapi msvcrt kernel32)
 add_cd_file(TARGET tftpd DESTINATION reactos/system32 FOR all)
+if (MSVC)
+    # Disable warning C4267: 'initializing': conversion from 'size_t' to
'unsigned short', possible loss of data
+    target_compile_options(tftpd PRIVATE /wd4267)
+endif()
+
 if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
     target_compile_options(tftpd PRIVATE -Wno-format-overflow)
 endif()
diff --git a/dll/3rdparty/libtirpc/CMakeLists.txt b/dll/3rdparty/libtirpc/CMakeLists.txt
index d2d97f2cb73..0975514febf 100644
--- a/dll/3rdparty/libtirpc/CMakeLists.txt
+++ b/dll/3rdparty/libtirpc/CMakeLists.txt
@@ -94,14 +94,10 @@ add_library(libtirpc MODULE
     ${CMAKE_CURRENT_BINARY_DIR}/libtirpc.def)
 if(MSVC)
-    # error C4133: '=': incompatible types - from 'char *' to
'int32_t *'
-    remove_target_compile_option(libtirpc "/we4133")
-    # Disable warning C4313 (format string conflicts)
-    remove_target_compile_option(libtirpc "/we4313")
-    # Disable warning C4477 (printf format warnings)
-    remove_target_compile_option(libtirpc "/we4477")
+    # Disable warning C4273: 'strtok_s': inconsistent dll linkage
+    # Disable warning C4313: 'fprintf': '%x' in format string conflicts
with argument 2 of type 'HANDLE'
+    target_compile_options(libtirpc PRIVATE /wd4273 /wd4313)
     if (NOT USE_CLANG_CL)
-        remove_target_compile_option(libtirpc "/we4101")
         target_compile_options(libtirpc PRIVATE /wd4101 /wd4133 /wd4473 /wd4477)
     endif()
 else()
diff --git a/dll/directx/wine/CMakeLists.txt b/dll/directx/wine/CMakeLists.txt
index ee7f69896ef..a6fcff25cc7 100644
--- a/dll/directx/wine/CMakeLists.txt
+++ b/dll/directx/wine/CMakeLists.txt
@@ -1,4 +1,10 @@
+if (MSVC)
+    # Disable warning C4090: 'function': different 'const' qualifiers
+    # Disable warning C4146: unary minus operator applied to unsigned type, result still
unsigned
+    add_compile_options(/wd4090 /wd4146)
+endif()
+
 add_subdirectory(amstream)
 add_subdirectory(d3d8)
 add_subdirectory(d3d9)
diff --git a/dll/win32/avifil32/CMakeLists.txt b/dll/win32/avifil32/CMakeLists.txt
index c1a9e84bc97..3d7b7799e7f 100644
--- a/dll/win32/avifil32/CMakeLists.txt
+++ b/dll/win32/avifil32/CMakeLists.txt
@@ -30,6 +30,11 @@ add_library(avifil32 MODULE
     ${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c
     ${CMAKE_CURRENT_BINARY_DIR}/avifil32.def)
+if(MSVC)
+    # Disable warning C4146: unary minus operator applied to unsigned type, result still
unsigned
+    target_compile_options(avifil32 PRIVATE /wd4146)
+endif()
+
 set_module_type(avifil32 win32dll)
 target_link_libraries(avifil32 wine ${PSEH_LIB})
 add_importlibs(avifil32 msacm32 msvfw32 winmm ole32 user32 advapi32 rpcrt4 msvcrt
kernel32 ntdll)
diff --git a/dll/win32/comctl32/CMakeLists.txt b/dll/win32/comctl32/CMakeLists.txt
index 2d963efb7e1..511167db4a1 100644
--- a/dll/win32/comctl32/CMakeLists.txt
+++ b/dll/win32/comctl32/CMakeLists.txt
@@ -65,8 +65,10 @@ add_library(comctl32 MODULE
     ${CMAKE_CURRENT_BINARY_DIR}/comctl32.def)
 if(MSVC)
+    # Disable warning C4146: unary minus operator applied to unsigned type, result still
unsigned
+    # Disable warning C4267: '=': conversion from 'size_t' to
'WORD', possible loss of data
     # Disable warning C4477 (printf format warnings)
-    remove_target_compile_option(comctl32 "/we4477")
+    target_compile_options(comctl32 PRIVATE /wd4146 /wd4267 /wd4477)
 endif()
 set_module_type(comctl32 win32dll UNICODE)
diff --git a/dll/win32/crypt32/CMakeLists.txt b/dll/win32/crypt32/CMakeLists.txt
index 6bb17abc850..2ee0078b2c1 100644
--- a/dll/win32/crypt32/CMakeLists.txt
+++ b/dll/win32/crypt32/CMakeLists.txt
@@ -47,8 +47,9 @@ add_library(crypt32 MODULE
     ${CMAKE_CURRENT_BINARY_DIR}/crypt32.def)
 if(MSVC)
-    # error C4312: 'type cast': conversion from 'unsigned int' to
'void *' of greater size
-    remove_target_compile_option(crypt32 "/we4312")
+    # Disable warning C4090: 'function': different 'const' qualifiers
+    # Disable warning C4312: 'type cast': conversion from 'unsigned int'
to 'void *' of greater size
+    target_compile_options(crypt32 PRIVATE /wd4090 /wd4312)
 endif()
 set_module_type(crypt32 win32dll)
diff --git a/dll/win32/dbghelp/CMakeLists.txt b/dll/win32/dbghelp/CMakeLists.txt
index ab1edd17410..3f858614a9e 100644
--- a/dll/win32/dbghelp/CMakeLists.txt
+++ b/dll/win32/dbghelp/CMakeLists.txt
@@ -81,7 +81,8 @@ else()
     add_cd_file(TARGET dbghelp DESTINATION reactos/system32 FOR all)
     if(MSVC)
+        # Disable warning C4146: unary minus operator applied to unsigned type, result
still unsigned
         # Disable warning C4477 (printf format warnings)
-        remove_target_compile_option(dbghelp "/we4477")
+        target_compile_options(dbghelp PRIVATE /wd4146 /wd4477)
     endif()
 endif()
diff --git a/dll/win32/gdiplus/CMakeLists.txt b/dll/win32/gdiplus/CMakeLists.txt
index c939dfa9ddb..65522334bf2 100644
--- a/dll/win32/gdiplus/CMakeLists.txt
+++ b/dll/win32/gdiplus/CMakeLists.txt
@@ -33,6 +33,12 @@ add_library(gdiplus MODULE
     gdiplus.rc
     ${CMAKE_CURRENT_BINARY_DIR}/gdiplus.def)
+if(MSVC)
+    # Disable warning C4146: unary minus operator applied to unsigned type, result still
unsigned
+    # Disable warning C4305: '=': truncation from 'double' to
'REAL'
+    target_compile_options(gdiplus PRIVATE /wd4146 /wd4305)
+endif()
+
 set_module_type(gdiplus win32dll)
 target_link_libraries(gdiplus wine)
 add_delay_importlibs(gdiplus windowscodecs)
diff --git a/dll/win32/jscript/CMakeLists.txt b/dll/win32/jscript/CMakeLists.txt
index 6337587d67a..1690bd6e2f6 100644
--- a/dll/win32/jscript/CMakeLists.txt
+++ b/dll/win32/jscript/CMakeLists.txt
@@ -55,6 +55,12 @@ add_library(jscript MODULE
     rsrc.rc
     ${CMAKE_CURRENT_BINARY_DIR}/jscript.def)
+if(MSVC)
+    # Disable warning C4146: unary minus operator applied to unsigned type, result still
unsigned
+    # Disable warning C4267: '=': conversion from 'size_t' to
'WCHAR', possible loss of data
+    target_compile_options(jscript PRIVATE /wd4146 /wd4267)
+endif()
+
 add_idl_headers(jscript_idlheader jscript_classes.idl)
 add_typelib(jsglobal.idl)
 add_dependencies(jscript jscript_idlheader stdole2)
diff --git a/dll/win32/kernel32/CMakeLists.txt b/dll/win32/kernel32/CMakeLists.txt
index 11339a91e60..1cc82f9d42b 100644
--- a/dll/win32/kernel32/CMakeLists.txt
+++ b/dll/win32/kernel32/CMakeLists.txt
@@ -93,6 +93,11 @@ list(APPEND SOURCE
     winnls/string/sortkey.c
     k32.h)
+if(MSVC)
+    # Disable warning C4146: unary minus operator applied to unsigned type, result still
unsigned
+    set_source_files_properties(wine/res.c PROPERTIES COMPILE_FLAGS /wd4146)
+endif()
+
 if(ARCH STREQUAL "i386")
     list(APPEND ASM_SOURCE
         client/i386/fiber.S
diff --git a/dll/win32/mciseq/CMakeLists.txt b/dll/win32/mciseq/CMakeLists.txt
index 8f1dd4ca5a3..6d0091f5e2d 100644
--- a/dll/win32/mciseq/CMakeLists.txt
+++ b/dll/win32/mciseq/CMakeLists.txt
@@ -13,6 +13,9 @@ target_link_libraries(mciseq wine)
 add_importlibs(mciseq winmm user32 msvcrt kernel32 ntdll)
 add_cd_file(TARGET mciseq DESTINATION reactos/system32 FOR all)
-if(NOT MSVC)
+if(MSVC)
+    # Disable warning C4305: '=': truncation from 'UINT' to
'WORD'
+    target_compile_options(mciseq PRIVATE /wd4305)
+else()
     target_compile_options(mciseq PRIVATE "-Wno-overflow")
 endif()
diff --git a/dll/win32/mciwave/CMakeLists.txt b/dll/win32/mciwave/CMakeLists.txt
index 569b91f212c..37f44ea86bd 100644
--- a/dll/win32/mciwave/CMakeLists.txt
+++ b/dll/win32/mciwave/CMakeLists.txt
@@ -16,6 +16,9 @@ target_link_libraries(mciwave wine)
 add_importlibs(mciwave user32 winmm msvcrt kernel32 ntdll)
 add_cd_file(TARGET mciwave DESTINATION reactos/system32 FOR all)
-if(NOT MSVC)
+if(MSVC)
+    # Disable warning C4305: '=': truncation from 'UINT' to
'WORD'
+    target_compile_options(mciwave PRIVATE /wd4305)
+else()
     target_compile_options(mciwave PRIVATE "-Wno-overflow")
 endif()
diff --git a/dll/win32/msi/CMakeLists.txt b/dll/win32/msi/CMakeLists.txt
index 983913b6097..1b674400b6c 100644
--- a/dll/win32/msi/CMakeLists.txt
+++ b/dll/win32/msi/CMakeLists.txt
@@ -64,11 +64,11 @@ add_library(msi MODULE
     ${CMAKE_CURRENT_BINARY_DIR}/msi.def)
 if(MSVC)
-    #  error C4133: 'function': incompatible types - from 'UINT *' to
'MSIINSTALLCONTEXT *'
-    remove_target_compile_option(msi "/we4133")
-
-    # error C4312: 'type cast': conversion from 'unsigned int' to
'HANDLE' of greater size
-    remove_target_compile_option(msi "/we4312")
+    # Disable warning C4090: 'function': different 'const' qualifiers
+    # Disable warning C4133: 'function': incompatible types - from 'UINT
*' to 'MSIINSTALLCONTEXT *'
+    # Disable warning C4146: unary minus operator applied to unsigned type, result still
unsigned
+    # Disable warning C4312: 'type cast': conversion from 'unsigned int'
to 'HANDLE' of greater size
+    target_compile_options(msi PRIVATE /wd4090 /wd4133 /wd4146 /wd4312)
 endif()
 add_idl_headers(msi_idlheader msiserver.idl)
diff --git a/dll/win32/msxml3/CMakeLists.txt b/dll/win32/msxml3/CMakeLists.txt
index 4d85db5d4ce..be0ebf4105f 100644
--- a/dll/win32/msxml3/CMakeLists.txt
+++ b/dll/win32/msxml3/CMakeLists.txt
@@ -76,6 +76,9 @@ target_link_libraries(msxml3 libxml2 iconv-static uuid wine zlib)
 if(MSVC)
     target_compile_options(msxml3 PRIVATE /FIwine/typeof.h /FImsvc.h)
+
+    # Disable warning C4090: 'function': different 'const' qualifiers
+    target_compile_options(msxml3 PRIVATE /wd4090)
 endif()
 add_importlibs(msxml3 urlmon ws2_32 shlwapi oleaut32 ole32 user32 msvcrt kernel32 ntdll)
diff --git a/dll/win32/netapi32/CMakeLists.txt b/dll/win32/netapi32/CMakeLists.txt
index bbc27a4b6e2..0c0c08744f1 100644
--- a/dll/win32/netapi32/CMakeLists.txt
+++ b/dll/win32/netapi32/CMakeLists.txt
@@ -58,3 +58,8 @@ add_delay_importlibs(netapi32 samlib secur32)
 add_importlibs(netapi32 iphlpapi ws2_32 advapi32 rpcrt4 msvcrt kernel32 ntdll)
 add_pch(netapi32 netapi32.h "${PCH_SKIP_SOURCE}")
 add_cd_file(TARGET netapi32 DESTINATION reactos/system32 FOR all)
+
+if(MSVC)
+    # Disable warning C4267: '=': conversion from 'size_t' to
'USHORT', possible loss of data
+    target_compile_options(netapi32 PRIVATE /wd4267)
+endif()
diff --git a/dll/win32/ole32/CMakeLists.txt b/dll/win32/ole32/CMakeLists.txt
index 61310a2b6ce..2ba952e681d 100644
--- a/dll/win32/ole32/CMakeLists.txt
+++ b/dll/win32/ole32/CMakeLists.txt
@@ -81,6 +81,12 @@ add_library(ole32 MODULE
     ${CMAKE_CURRENT_BINARY_DIR}/irot_c.c
     ${CMAKE_CURRENT_BINARY_DIR}/ole32.def)
+if(MSVC)
+    # Disable warning C4090: '=': different 'const' qualifiers
+    # Disable warning C4146: unary minus operator applied to unsigned type, result still
unsigned
+    target_compile_options(ole32 PRIVATE /wd4090 /wd4146)
+endif()
+
 set_module_type(ole32 win32dll)
 target_link_libraries(ole32 wine uuid ${PSEH_LIB})
 add_delay_importlibs(ole32 oleaut32)
diff --git a/dll/win32/oleaut32/CMakeLists.txt b/dll/win32/oleaut32/CMakeLists.txt
index 44bdb0a9871..700a878c631 100644
--- a/dll/win32/oleaut32/CMakeLists.txt
+++ b/dll/win32/oleaut32/CMakeLists.txt
@@ -49,6 +49,12 @@ add_library(oleaut32 MODULE
     oleaut32.rc
     ${CMAKE_CURRENT_BINARY_DIR}/oleaut32.def)
+if(MSVC)
+    # Disable warning C4146: unary minus operator applied to unsigned type, result still
unsigned
+    # Disable warning C4267: 'initializing': conversion from 'size_t' to
'BYTE', possible loss of data
+    target_compile_options(oleaut32 PRIVATE /wd4146 /wd4267)
+endif()
+
 add_idl_headers(oleaut32_idlheader oleaut32_oaidl.idl)
 add_dependencies(oleaut32 oleaut32_idlheader)
 set_module_type(oleaut32 win32dll)
diff --git a/dll/win32/rpcrt4/CMakeLists.txt b/dll/win32/rpcrt4/CMakeLists.txt
index c1f8de9f68f..90c9225847a 100644
--- a/dll/win32/rpcrt4/CMakeLists.txt
+++ b/dll/win32/rpcrt4/CMakeLists.txt
@@ -58,6 +58,11 @@ add_library(rpcrt4 MODULE
     rpcrt4.rc
     ${CMAKE_CURRENT_BINARY_DIR}/rpcrt4.def)
+if(MSVC)
+    # Disable warning C4267: '=': conversion from 'size_t' to
'short', possible loss of data
+    target_compile_options(rpcrt4 PRIVATE /wd4267)
+endif()
+
 set_module_type(rpcrt4 win32dll)
 target_link_libraries(rpcrt4 wine uuid ${PSEH_LIB})
 add_delay_importlibs(rpcrt4 iphlpapi wininet secur32 user32 oleaut32)
diff --git a/dll/win32/vbscript/CMakeLists.txt b/dll/win32/vbscript/CMakeLists.txt
index 145e7364bfa..f2842c8d4e0 100644
--- a/dll/win32/vbscript/CMakeLists.txt
+++ b/dll/win32/vbscript/CMakeLists.txt
@@ -39,6 +39,11 @@ add_library(vbscript MODULE
     vbscript.rc
     ${CMAKE_CURRENT_BINARY_DIR}/vbscript.def)
+if(MSVC)
+    # Disable warning C4267: '=': conversion from 'size_t' to
'WCHAR', possible loss of data
+    target_compile_options(vbscript PRIVATE /wd4267)
+endif()
+
 set_module_type(vbscript win32dll)
 target_link_libraries(vbscript uuid wine)
 add_importlibs(vbscript oleaut32 ole32 user32 msvcrt kernel32 ntdll)
diff --git a/dll/win32/windowscodecs/CMakeLists.txt
b/dll/win32/windowscodecs/CMakeLists.txt
index 316fd1f329b..d4fc4b281b2 100644
--- a/dll/win32/windowscodecs/CMakeLists.txt
+++ b/dll/win32/windowscodecs/CMakeLists.txt
@@ -71,8 +71,9 @@ add_library(windowscodecs MODULE
     ${CMAKE_CURRENT_BINARY_DIR}/windowscodecs.def)
 if(MSVC)
-    # error C4133: 'function': incompatible types - from
'WICPixelFormatNumericRepresentation *' to 'DWORD *'
-    remove_target_compile_option(windowscodecs "/we4133")
+    # Disable warning C4133: 'function': incompatible types - from
'WICPixelFormatNumericRepresentation *' to 'DWORD *'
+    # Disable warning C4146: unary minus operator applied to unsigned type, result still
unsigned
+    target_compile_options(windowscodecs PRIVATE /wd4133 /wd4146)
     target_compile_options(windowscodecs PRIVATE /FItypeof.h)
 endif()
diff --git a/dll/win32/wininet/CMakeLists.txt b/dll/win32/wininet/CMakeLists.txt
index eb4b9d12992..6b041deb423 100644
--- a/dll/win32/wininet/CMakeLists.txt
+++ b/dll/win32/wininet/CMakeLists.txt
@@ -39,6 +39,11 @@ add_library(wininet MODULE
     rsrc.rc
     ${CMAKE_CURRENT_BINARY_DIR}/wininet.def)
+if(MSVC)
+    # Disable warning C4090: 'function': different 'const' qualifiers
+    target_compile_options(wininet PRIVATE /wd4090)
+endif()
+
 set_module_type(wininet win32dll)
 target_link_libraries(wininet wine ${PSEH_LIB} oldnames)
diff --git a/dll/win32/winmm/CMakeLists.txt b/dll/win32/winmm/CMakeLists.txt
index d6bc6b7f478..f6943f915b4 100644
--- a/dll/win32/winmm/CMakeLists.txt
+++ b/dll/win32/winmm/CMakeLists.txt
@@ -23,8 +23,9 @@ add_library(winmm MODULE
 if(MSVC)
-    # error C4312: 'type cast': conversion from 'DWORD' to
'HTASK' of greater size
-    remove_target_compile_option(winmm "/we4312")
+    # Disable warning C4090: 'function': different 'const' qualifiers
+    # Disable warning C4312: 'type cast': conversion from 'DWORD' to
'HTASK' of greater size
+    target_compile_options(winmm PRIVATE /wd4090 /wd4312)
 endif()
 set_module_type(winmm win32dll)
diff --git a/dll/win32/wintrust/CMakeLists.txt b/dll/win32/wintrust/CMakeLists.txt
index d47599c97a2..c6ee5b01338 100644
--- a/dll/win32/wintrust/CMakeLists.txt
+++ b/dll/win32/wintrust/CMakeLists.txt
@@ -17,6 +17,11 @@ add_library(wintrust MODULE
     version.rc
     ${CMAKE_CURRENT_BINARY_DIR}/wintrust.def)
+if(MSVC)
+    # Disable warning C4090: 'function': different 'const' qualifiers
+    target_compile_options(wintrust PRIVATE /wd4090)
+endif()
+
 set_module_type(wintrust win32dll)
 target_link_libraries(wintrust wine ${PSEH_LIB})
 # FIXME: imagehlp should be delay-imported. See CORE-6504
diff --git a/dll/win32/xmllite/CMakeLists.txt b/dll/win32/xmllite/CMakeLists.txt
index 19ebd3879ef..8d432444ec4 100644
--- a/dll/win32/xmllite/CMakeLists.txt
+++ b/dll/win32/xmllite/CMakeLists.txt
@@ -15,6 +15,11 @@ add_library(xmllite MODULE
     guid.c
     ${CMAKE_CURRENT_BINARY_DIR}/xmllite.def)
+if(MSVC)
+    # Disable warning C4146: unary minus operator applied to unsigned type, result still
unsigned
+    target_compile_options(xmllite PRIVATE /wd4146)
+endif()
+
 set_module_type(xmllite win32dll)
 target_link_libraries(xmllite uuid wine)
 add_importlibs(xmllite msvcrt kernel32 ntdll)
diff --git a/drivers/bluetooth/fbtusb/CMakeLists.txt
b/drivers/bluetooth/fbtusb/CMakeLists.txt
index 7de68e74752..8358c974d79 100644
--- a/drivers/bluetooth/fbtusb/CMakeLists.txt
+++ b/drivers/bluetooth/fbtusb/CMakeLists.txt
@@ -16,6 +16,11 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
     target_compile_options(fbtusb PRIVATE -Wno-unused-but-set-variable)
 endif()
+if(MSVC)
+    # Disable warning C4267: '=': conversion from 'size_t' to
'USHORT', possible loss of data
+    target_compile_options(fbtusb PRIVATE /wd4267)
+endif()
+
 set_module_type(fbtusb kernelmodedriver)
 add_importlibs(fbtusb ntoskrnl hal usbd)
 add_pch(fbtusb precomp.h SOURCE)
diff --git a/drivers/filesystems/btrfs/CMakeLists.txt
b/drivers/filesystems/btrfs/CMakeLists.txt
index 0fd490853ca..e7427fd8e4a 100644
--- a/drivers/filesystems/btrfs/CMakeLists.txt
+++ b/drivers/filesystems/btrfs/CMakeLists.txt
@@ -65,6 +65,11 @@ add_asm_files(btrfs_asm ${ASM_SOURCE})
 add_library(btrfs MODULE ${SOURCE} ${btrfs_asm} btrfs.rc)
+if(MSVC)
+    # Disable warning C4267: 'function': conversion from 'size_t' to
'uint16_t', possible loss of data
+    target_compile_options(btrfs PRIVATE /wd4267)
+endif()
+
 add_definitions(-D__KERNEL__)
 set_module_type(btrfs kernelmodedriver)
 target_link_libraries(btrfs rtlver zlib_solo chkstk wdmguid ${PSEH_LIB})
diff --git a/drivers/filesystems/ext2/CMakeLists.txt
b/drivers/filesystems/ext2/CMakeLists.txt
index 06c51e756c3..b948b50c9b5 100644
--- a/drivers/filesystems/ext2/CMakeLists.txt
+++ b/drivers/filesystems/ext2/CMakeLists.txt
@@ -93,11 +93,11 @@ if(USE_CLANG_CL)
 endif()
 if(MSVC)
-    # Disable warnings: "unreferenced local variable", "initialized, but
not used variable", "benign include"
     if (NOT CLANG)
-        remove_target_compile_option(ext2fs "/we4101")
-        remove_target_compile_option(ext2fs "/we4189")
-        target_compile_options(ext2fs PRIVATE /wd4189 /wd4142 /wd4101)
+        # Disable warning C4101: 'i': unreferenced local variable
+        # Disable warning C4189: 'sbi': local variable is initialized but not
referenced
+        # Disable warning C4267: '=': conversion from 'size_t' to
'USHORT', possible loss of data
+        target_compile_options(ext2fs PRIVATE /wd4101 /wd4189 /wd4267)
     endif()
 else()
     target_compile_options(ext2fs PRIVATE
diff --git a/drivers/storage/ide/uniata/CMakeLists.txt
b/drivers/storage/ide/uniata/CMakeLists.txt
index c172d96ac54..6b9cdcff5e9 100644
--- a/drivers/storage/ide/uniata/CMakeLists.txt
+++ b/drivers/storage/ide/uniata/CMakeLists.txt
@@ -28,6 +28,12 @@ if(USE_CLANG_CL OR (NOT MSVC))
     endif()
 endif()
+if(MSVC)
+    # Disable warning C4267: '=': conversion from 'size_t' to
'USHORT', possible loss of data
+    # Disable warning C4838: conversion from 'int' to 'ULONG' requires a
narrowing conversion
+    target_compile_options(uniata PRIVATE /wd4267 /wd4838)
+endif()
+
 if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
     target_compile_options(uniata PRIVATE -Wno-unused-but-set-variable)
 endif()
diff --git a/modules/rostests/winetests/riched20/CMakeLists.txt
b/modules/rostests/winetests/riched20/CMakeLists.txt
index fe220a495ba..15c730ab8d0 100644
--- a/modules/rostests/winetests/riched20/CMakeLists.txt
+++ b/modules/rostests/winetests/riched20/CMakeLists.txt
@@ -7,10 +7,6 @@ list(APPEND SOURCE
     testlist.c
     txtsrv.c)
-if(MSVC)
-    set_property(SOURCE editor.c APPEND_STRING PROPERTY COMPILE_FLAGS "
/w14189")
-endif()
-
 add_executable(riched20_winetest ${SOURCE})
 set_module_type(riched20_winetest win32cui)
 add_importlibs(riched20_winetest ole32 oleaut32 user32 gdi32 msvcrt kernel32)
diff --git a/sdk/lib/fslib/ext2lib/CMakeLists.txt b/sdk/lib/fslib/ext2lib/CMakeLists.txt
index 103760b751b..72b39211d1b 100644
--- a/sdk/lib/fslib/ext2lib/CMakeLists.txt
+++ b/sdk/lib/fslib/ext2lib/CMakeLists.txt
@@ -14,3 +14,8 @@ list(APPEND SOURCE
 add_library(ext2lib ${SOURCE})
 add_pch(ext2lib Mke2fs.h SOURCE)
 add_dependencies(ext2lib psdk)
+
+if(MSVC)
+    # Disable warning C4267: '=': conversion from 'size_t' to
'__u8', possible loss of data
+    target_compile_options(ext2lib PRIVATE /wd4267)
+endif()