https://git.reactos.org/?p=reactos.git;a=commitdiff;h=74ec94e12c7a4e8c7a6af…
commit 74ec94e12c7a4e8c7a6af6dfadc605ec54b46f07
Author: Victor Perevertkin <victor.perevertkin(a)reactos.org>
AuthorDate: Fri Apr 9 03:58:19 2021 +0300
Commit: Victor Perevertkin <victor.perevertkin(a)reactos.org>
CommitDate: Fri Apr 9 03:58:19 2021 +0300
[CMAKE] Some options are only supported by GCC, don't use them for clang
These are (so far):
-Wno-format-overflow
-Wno-nonnull-compare
-Wno-old-style-declaration
-Wno-unused-but-set-variable
---
base/applications/network/telnet/CMakeLists.txt | 7 ++++++-
base/services/tftpd/CMakeLists.txt | 2 +-
dll/3rdparty/libtiff/CMakeLists.txt | 6 ++++--
dll/directx/wine/wined3d/CMakeLists.txt | 2 +-
dll/opengl/glu32/CMakeLists.txt | 10 +++++++---
dll/win32/browseui/CMakeLists.txt | 5 ++++-
dll/win32/browseui/shellbars/CMakeLists.txt | 4 ++--
dll/win32/browseui/shellfind/CMakeLists.txt | 4 ++--
dll/win32/winmm/CMakeLists.txt | 4 ++--
drivers/bluetooth/fbtusb/CMakeLists.txt | 4 ++--
drivers/filesystems/ext2/CMakeLists.txt | 7 ++++---
drivers/filesystems/ffs/CMakeLists.txt | 6 ++++--
drivers/filesystems/reiserfs/CMakeLists.txt | 5 ++++-
drivers/filesystems/udfs/CMakeLists.txt | 6 ++++--
drivers/network/dd/netkvm/CMakeLists.txt | 6 ++++--
drivers/storage/class/classpnp/CMakeLists.txt | 6 +++++-
drivers/storage/class/disk_new/CMakeLists.txt | 6 +++++-
drivers/storage/ide/uniata/CMakeLists.txt | 6 ++++--
modules/rosapps/applications/devutils/symdump/CMakeLists.txt | 4 ++--
modules/rosapps/applications/net/ncftp/CMakeLists.txt | 2 +-
modules/rosapps/applications/sysutils/logevent/CMakeLists.txt | 4 ++--
modules/rosapps/applications/sysutils/pedump/CMakeLists.txt | 4 ++--
.../rosapps/applications/sysutils/utils/rosperf/CMakeLists.txt | 4 ++--
modules/rosapps/templates/dialog/CMakeLists.txt | 4 ++--
modules/rostests/winetests/advpack/CMakeLists.txt | 2 +-
modules/rostests/winetests/fusion/CMakeLists.txt | 2 +-
modules/rostests/winetests/msi/CMakeLists.txt | 2 +-
modules/rostests/winetests/ole32/CMakeLists.txt | 4 +++-
modules/rostests/winetests/services/CMakeLists.txt | 2 +-
modules/rostests/winetests/setupapi/CMakeLists.txt | 2 +-
modules/rostests/winetests/shell32/CMakeLists.txt | 4 +++-
modules/rostests/winetests/user32/CMakeLists.txt | 4 +++-
modules/rostests/winetests/version/CMakeLists.txt | 8 +++++---
sdk/lib/3rdparty/adns/CMakeLists.txt | 4 ++--
sdk/lib/3rdparty/cardlib/CMakeLists.txt | 4 ++--
35 files changed, 99 insertions(+), 57 deletions(-)
diff --git a/base/applications/network/telnet/CMakeLists.txt
b/base/applications/network/telnet/CMakeLists.txt
index d77a95cc8bd..7bb174f62f2 100644
--- a/base/applications/network/telnet/CMakeLists.txt
+++ b/base/applications/network/telnet/CMakeLists.txt
@@ -24,10 +24,15 @@ list(APPEND SOURCE
add_executable(telnet ${SOURCE} telnet.rc)
target_link_libraries(telnet cppstl)
set_target_cpp_properties(telnet WITH_EXCEPTIONS)
+
if (NOT MSVC)
- target_compile_options(telnet PRIVATE -Wno-restrict
$<$<COMPILE_LANGUAGE:CXX>:-Wno-narrowing>)
target_compile_definitions(telnet PRIVATE _CRT_NONSTDC_NO_DEPRECATE)
endif()
+
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(telnet PRIVATE -Wno-restrict
$<$<COMPILE_LANGUAGE:CXX>:-Wno-narrowing>)
+endif()
+
set_module_type(telnet win32cui)
add_importlibs(telnet ws2_32 user32 msvcrt kernel32 ntdll)
add_pch(telnet precomp.h SOURCE)
diff --git a/base/services/tftpd/CMakeLists.txt b/base/services/tftpd/CMakeLists.txt
index 1b10567bd7f..1790a81dff6 100644
--- a/base/services/tftpd/CMakeLists.txt
+++ b/base/services/tftpd/CMakeLists.txt
@@ -4,6 +4,6 @@ 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(GCC OR CLANG)
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(tftpd PRIVATE -Wno-format-overflow)
endif()
diff --git a/dll/3rdparty/libtiff/CMakeLists.txt b/dll/3rdparty/libtiff/CMakeLists.txt
index fc98c11cac4..f7c0b904c23 100644
--- a/dll/3rdparty/libtiff/CMakeLists.txt
+++ b/dll/3rdparty/libtiff/CMakeLists.txt
@@ -67,6 +67,8 @@ if(MSVC)
remove_target_compile_option(libtiff "/we4311")
# error C4312: 'type cast': conversion from 'int' to
'thandle_t' of greater size
remove_target_compile_option(libtiff "/we4312")
-else()
- target_compile_options(libtiff PRIVATE "-Wno-unused-but-set-variable")
+endif()
+
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(libtiff PRIVATE -Wno-unused-but-set-variable)
endif()
diff --git a/dll/directx/wine/wined3d/CMakeLists.txt
b/dll/directx/wine/wined3d/CMakeLists.txt
index 3af303fd783..10f144b93e6 100644
--- a/dll/directx/wine/wined3d/CMakeLists.txt
+++ b/dll/directx/wine/wined3d/CMakeLists.txt
@@ -53,6 +53,6 @@ add_importlibs(d3dwine user32 opengl32 gdi32 advapi32 msvcrt kernel32
ntdll)
add_pch(d3dwine precomp.h SOURCE)
add_cd_file(TARGET d3dwine DESTINATION reactos/system32 FOR all)
-if(NOT MSVC)
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(d3dwine PRIVATE -Wno-format-overflow)
endif()
diff --git a/dll/opengl/glu32/CMakeLists.txt b/dll/opengl/glu32/CMakeLists.txt
index 490732e6d49..ffa8a540818 100644
--- a/dll/opengl/glu32/CMakeLists.txt
+++ b/dll/opengl/glu32/CMakeLists.txt
@@ -121,14 +121,18 @@ target_link_libraries(glu32 cpprt)
set_module_type(glu32 win32dll)
if(NOT MSVC)
- target_compile_options(glu32 PRIVATE -Wno-write-strings
-Wno-unused-but-set-variable)
- # Prevent a warning when comparing 'this' against 0
- set_source_files_properties(src/libnurbs/internals/arc.cc PROPERTIES COMPILE_FLAGS
"-Wno-nonnull-compare")
+ target_compile_options(glu32 PRIVATE -Wno-write-strings)
elseif(USE_CLANG_CL)
target_compile_options(glu32 PRIVATE -Wno-self-assign -Wno-unused-function
-Wno-microsoft-include)
target_compile_options(glu32 PRIVATE -Wno-deprecated-register
-Wno-tautological-undefined-compare)
endif()
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(glu32 PRIVATE -Wno-unused-but-set-variable)
+ # Prevent a warning when comparing 'this' against 0
+ set_source_files_properties(src/libnurbs/internals/arc.cc PROPERTIES COMPILE_FLAGS
"-Wno-nonnull-compare")
+endif()
+
add_importlibs(glu32 opengl32 gdi32 msvcrt kernel32 ntdll)
add_pch(glu32 precomp.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET glu32 DESTINATION reactos/system32 FOR all)
diff --git a/dll/win32/browseui/CMakeLists.txt b/dll/win32/browseui/CMakeLists.txt
index d606fbfbb18..146ee786ca7 100644
--- a/dll/win32/browseui/CMakeLists.txt
+++ b/dll/win32/browseui/CMakeLists.txt
@@ -53,8 +53,11 @@ add_importlibs(browseui uxtheme shlwapi shell32 comctl32 gdi32 ole32
oleaut32 us
add_pch(browseui precomp.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET browseui DESTINATION reactos/system32 FOR all)
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(browseui PRIVATE -Wno-unused-but-set-variable)
+endif()
+
if(NOT MSVC)
- target_compile_options(browseui PRIVATE "-Wno-unused-but-set-variable")
# Binutils linker bug
if(LTCG)
add_target_link_flags(browseui "-Wl,--allow-multiple-definition")
diff --git a/dll/win32/browseui/shellbars/CMakeLists.txt
b/dll/win32/browseui/shellbars/CMakeLists.txt
index 360c785e5c3..bf64a68c96f 100644
--- a/dll/win32/browseui/shellbars/CMakeLists.txt
+++ b/dll/win32/browseui/shellbars/CMakeLists.txt
@@ -14,8 +14,8 @@ list(APPEND SOURCE
add_library(shellbars OBJECT ${SOURCE})
target_link_libraries(shellbars PRIVATE atl_classes)
-if(NOT MSVC)
- target_compile_options(shellbars PRIVATE "-Wno-unused-but-set-variable")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(shellbars PRIVATE -Wno-unused-but-set-variable)
endif()
add_pch(shellbars shellbars.h SOURCE)
diff --git a/dll/win32/browseui/shellfind/CMakeLists.txt
b/dll/win32/browseui/shellfind/CMakeLists.txt
index 72f15422fcd..43c31511710 100644
--- a/dll/win32/browseui/shellfind/CMakeLists.txt
+++ b/dll/win32/browseui/shellfind/CMakeLists.txt
@@ -11,8 +11,8 @@ list(APPEND SOURCE
add_library(shellfind OBJECT ${SOURCE})
target_link_libraries(shellfind PRIVATE atl_classes)
-if(NOT MSVC)
- target_compile_options(shellfind PRIVATE "-Wno-unused-but-set-variable")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(shellfind PRIVATE -Wno-unused-but-set-variable)
endif()
add_pch(shellfind shellfind.h SOURCE)
diff --git a/dll/win32/winmm/CMakeLists.txt b/dll/win32/winmm/CMakeLists.txt
index 640ebf63081..d6bc6b7f478 100644
--- a/dll/win32/winmm/CMakeLists.txt
+++ b/dll/win32/winmm/CMakeLists.txt
@@ -33,8 +33,8 @@ add_importlibs(winmm advapi32 user32 msvcrt kernel32 ntdll)
add_pch(winmm winemm.h SOURCE)
add_cd_file(TARGET winmm DESTINATION reactos/system32 FOR all)
-if(NOT MSVC)
- target_compile_options(winmm PRIVATE "-Wno-unused-but-set-variable")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(winmm PRIVATE -Wno-unused-but-set-variable)
endif()
add_subdirectory(midimap)
diff --git a/drivers/bluetooth/fbtusb/CMakeLists.txt
b/drivers/bluetooth/fbtusb/CMakeLists.txt
index 20c8d7bfd12..7de68e74752 100644
--- a/drivers/bluetooth/fbtusb/CMakeLists.txt
+++ b/drivers/bluetooth/fbtusb/CMakeLists.txt
@@ -12,8 +12,8 @@ list(APPEND SOURCE
add_library(fbtusb MODULE ${SOURCE} fbtusb.rc)
-if(NOT MSVC)
- target_compile_options(fbtusb PRIVATE "-Wno-unused-but-set-variable")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(fbtusb PRIVATE -Wno-unused-but-set-variable)
endif()
set_module_type(fbtusb kernelmodedriver)
diff --git a/drivers/filesystems/ext2/CMakeLists.txt
b/drivers/filesystems/ext2/CMakeLists.txt
index dadf04c06b7..06c51e756c3 100644
--- a/drivers/filesystems/ext2/CMakeLists.txt
+++ b/drivers/filesystems/ext2/CMakeLists.txt
@@ -103,9 +103,10 @@ else()
target_compile_options(ext2fs PRIVATE
-Wno-pointer-sign -Wno-unused-function
-Wno-unused-variable -Wno-missing-braces)
- if (NOT CLANG)
- target_compile_options(ext2fs PRIVATE -Wno-unused-but-set-variable)
- endif()
+endif()
+
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(ext2fs PRIVATE -Wno-unused-but-set-variable)
endif()
if(CLANG)
diff --git a/drivers/filesystems/ffs/CMakeLists.txt
b/drivers/filesystems/ffs/CMakeLists.txt
index b2e5135b84a..9d5670aaa56 100644
--- a/drivers/filesystems/ffs/CMakeLists.txt
+++ b/drivers/filesystems/ffs/CMakeLists.txt
@@ -35,11 +35,13 @@ if(USE_CLANG_CL OR (NOT MSVC))
target_compile_options(ffs PRIVATE -Wno-unused-variable -Wno-missing-braces)
if(USE_CLANG_CL)
target_compile_options(ffs PRIVATE -Wno-empty-body)
- else()
- target_compile_options(ffs PRIVATE -Wno-unused-but-set-variable)
endif()
endif()
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(ffs PRIVATE -Wno-unused-but-set-variable)
+endif()
+
add_definitions(-D__KERNEL__)
set_module_type(ffs kernelmodedriver)
target_link_libraries(ffs memcmp ${PSEH_LIB})
diff --git a/drivers/filesystems/reiserfs/CMakeLists.txt
b/drivers/filesystems/reiserfs/CMakeLists.txt
index b921bbfa250..84e680eb2f7 100644
--- a/drivers/filesystems/reiserfs/CMakeLists.txt
+++ b/drivers/filesystems/reiserfs/CMakeLists.txt
@@ -82,7 +82,6 @@ if(USE_CLANG_CL OR (NOT MSVC))
target_compile_options(reiserfs PRIVATE -Wno-missing-braces -Wno-pointer-sign)
target_compile_options(reiserfs PRIVATE -Wno-unused-function -Wno-unused-variable)
if(NOT USE_CLANG_CL)
- target_compile_options(reiserfs PRIVATE -Wno-unused-but-set-variable)
target_compile_definitions(reiserfs PRIVATE __GCC__)
endif()
else()
@@ -92,6 +91,10 @@ else()
target_compile_options(reiserfs PRIVATE /wd4189 /wd4142 /wd4101)
endif()
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(reiserfs PRIVATE -Wno-unused-but-set-variable)
+endif()
+
target_link_libraries(reiserfs memcmp ${PSEH_LIB})
add_definitions(-D__KERNEL__ -D_CRT_NO_POSIX_ERROR_CODES)
set_module_type(reiserfs kernelmodedriver)
diff --git a/drivers/filesystems/udfs/CMakeLists.txt
b/drivers/filesystems/udfs/CMakeLists.txt
index 292fe2421e3..dd1b7a5694a 100644
--- a/drivers/filesystems/udfs/CMakeLists.txt
+++ b/drivers/filesystems/udfs/CMakeLists.txt
@@ -50,8 +50,10 @@ if(MSVC)
target_compile_options(udfs PRIVATE -Wno-tautological-unsigned-zero-compare
-Wno-self-assign)
target_compile_options(udfs PRIVATE -Wno-sometimes-uninitialized
-Wno-parentheses-equality)
endif()
-else()
- target_compile_options(udfs PRIVATE "-Wno-unused-but-set-variable")
+endif()
+
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(udfs PRIVATE -Wno-unused-but-set-variable)
endif()
set_module_type(udfs kernelmodedriver)
diff --git a/drivers/network/dd/netkvm/CMakeLists.txt
b/drivers/network/dd/netkvm/CMakeLists.txt
index ac916e92cab..26ff48a184b 100644
--- a/drivers/network/dd/netkvm/CMakeLists.txt
+++ b/drivers/network/dd/netkvm/CMakeLists.txt
@@ -29,11 +29,13 @@ add_driver_inf(netkvm netkvm.inf)
if(NOT MSVC)
target_compile_options(netkvm PRIVATE
-Wno-unused-function
- -Wno-old-style-declaration
-Wno-unknown-pragmas
- -Wno-unused-but-set-variable
-Wno-pointer-sign
-Wno-pointer-to-int-cast
-Wno-int-to-pointer-cast
-Wno-attributes)
endif()
+
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(netkvm PRIVATE -Wno-old-style-declaration
-Wno-unused-but-set-variable)
+endif()
diff --git a/drivers/storage/class/classpnp/CMakeLists.txt
b/drivers/storage/class/classpnp/CMakeLists.txt
index fc80d6dba6b..a1cee352784 100644
--- a/drivers/storage/class/classpnp/CMakeLists.txt
+++ b/drivers/storage/class/classpnp/CMakeLists.txt
@@ -42,7 +42,11 @@ target_compile_definitions(classpnp PRIVATE
CLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFERS=512)
if(GCC)
- target_compile_options(classpnp PRIVATE -Wno-unused-but-set-variable
-Wno-pointer-to-int-cast -Wno-switch)
+ target_compile_options(classpnp PRIVATE -Wno-pointer-to-int-cast -Wno-switch)
+endif()
+
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(classpnp PRIVATE -Wno-unused-but-set-variable)
endif()
set_module_type(classpnp kernelmodedriver)
diff --git a/drivers/storage/class/disk_new/CMakeLists.txt
b/drivers/storage/class/disk_new/CMakeLists.txt
index 8c11bc30a72..68407eafe56 100644
--- a/drivers/storage/class/disk_new/CMakeLists.txt
+++ b/drivers/storage/class/disk_new/CMakeLists.txt
@@ -21,7 +21,11 @@ if(USE_CLANG_CL OR (NOT MSVC))
endif()
if(GCC)
- target_compile_options(disk PRIVATE -Wno-unused-but-set-variable
-Wno-pointer-to-int-cast -Wno-switch)
+ target_compile_options(disk PRIVATE -Wno-pointer-to-int-cast -Wno-switch)
+endif()
+
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(disk PRIVATE -Wno-unused-but-set-variable)
endif()
set_module_type(disk kernelmodedriver)
diff --git a/drivers/storage/ide/uniata/CMakeLists.txt
b/drivers/storage/ide/uniata/CMakeLists.txt
index 0df8e748a6c..c172d96ac54 100644
--- a/drivers/storage/ide/uniata/CMakeLists.txt
+++ b/drivers/storage/ide/uniata/CMakeLists.txt
@@ -25,11 +25,13 @@ if(USE_CLANG_CL OR (NOT MSVC))
target_compile_options(uniata PRIVATE "-Wno-narrowing")
if(USE_CLANG_CL)
target_compile_options(uniata PRIVATE "-Wno-unused-const-variable")
- else()
- target_compile_options(uniata PRIVATE "-Wno-unused-but-set-variable")
endif()
endif()
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(uniata PRIVATE -Wno-unused-but-set-variable)
+endif()
+
add_pch(uniata stdafx.h SOURCE)
set_module_type(uniata kernelmodedriver)
add_importlibs(uniata scsiport ntoskrnl hal)
diff --git a/modules/rosapps/applications/devutils/symdump/CMakeLists.txt
b/modules/rosapps/applications/devutils/symdump/CMakeLists.txt
index 0e0bd3b2adf..327566bf97b 100644
--- a/modules/rosapps/applications/devutils/symdump/CMakeLists.txt
+++ b/modules/rosapps/applications/devutils/symdump/CMakeLists.txt
@@ -4,7 +4,7 @@ add_executable(symdump symdump.c)
set_module_type(symdump win32cui)
target_link_libraries(symdump wine)
add_importlibs(symdump dbghelp shlwapi msvcrt kernel32 ntdll)
-if(NOT MSVC)
- target_compile_options(symdump PRIVATE "-Wno-unused-but-set-variable")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(symdump PRIVATE -Wno-unused-but-set-variable)
endif()
add_cd_file(TARGET symdump DESTINATION reactos/system32 FOR all)
diff --git a/modules/rosapps/applications/net/ncftp/CMakeLists.txt
b/modules/rosapps/applications/net/ncftp/CMakeLists.txt
index 41ad22bd30e..7b080fbb687 100644
--- a/modules/rosapps/applications/net/ncftp/CMakeLists.txt
+++ b/modules/rosapps/applications/net/ncftp/CMakeLists.txt
@@ -71,7 +71,7 @@ list(APPEND SOURCE
add_executable(ncftp ${SOURCE} ncftp.rc)
set_module_type(ncftp win32cui)
target_compile_definitions(ncftp PRIVATE HAVE_UTIME_H HAVE_UNISTD_H)
-if(NOT MSVC)
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(ncftp PRIVATE -Wno-unused-but-set-variable)
endif()
add_importlibs(ncftp advapi32 user32 ws2_32 msvcrt kernel32)
diff --git a/modules/rosapps/applications/sysutils/logevent/CMakeLists.txt
b/modules/rosapps/applications/sysutils/logevent/CMakeLists.txt
index 7b5aba3b6cb..2d2311a4a1d 100644
--- a/modules/rosapps/applications/sysutils/logevent/CMakeLists.txt
+++ b/modules/rosapps/applications/sysutils/logevent/CMakeLists.txt
@@ -1,8 +1,8 @@
add_executable(logevent logevent.c logevent.rc)
set_module_type(logevent win32cui)
-if(NOT MSVC)
- target_compile_options(logevent PRIVATE "-Wno-unused-but-set-variable")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(logevent PRIVATE -Wno-unused-but-set-variable)
endif()
add_importlibs(logevent advapi32 msvcrt kernel32)
add_cd_file(TARGET logevent DESTINATION reactos/system32 FOR all)
diff --git a/modules/rosapps/applications/sysutils/pedump/CMakeLists.txt
b/modules/rosapps/applications/sysutils/pedump/CMakeLists.txt
index ca2eade1876..6d15201f7b8 100644
--- a/modules/rosapps/applications/sysutils/pedump/CMakeLists.txt
+++ b/modules/rosapps/applications/sysutils/pedump/CMakeLists.txt
@@ -1,8 +1,8 @@
add_executable(pedump pedump.c pedump.rc)
set_module_type(pedump win32cui)
-if(NOT MSVC)
- target_compile_options(pedump PRIVATE "-Wno-unused-but-set-variable")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(pedump PRIVATE -Wno-unused-but-set-variable)
endif()
add_importlibs(pedump msvcrt kernel32 ntdll)
add_cd_file(TARGET pedump DESTINATION reactos/system32 FOR all)
diff --git a/modules/rosapps/applications/sysutils/utils/rosperf/CMakeLists.txt
b/modules/rosapps/applications/sysutils/utils/rosperf/CMakeLists.txt
index 748d0f03544..5d70928f475 100644
--- a/modules/rosapps/applications/sysutils/utils/rosperf/CMakeLists.txt
+++ b/modules/rosapps/applications/sysutils/utils/rosperf/CMakeLists.txt
@@ -11,8 +11,8 @@ list(APPEND SOURCE
add_executable(rosperf ${SOURCE} rosperf.rc)
set_module_type(rosperf win32cui UNICODE)
-if(NOT MSVC)
- target_compile_options(rosperf PRIVATE "-Wno-unused-but-set-variable")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(rosperf PRIVATE -Wno-unused-but-set-variable)
endif()
add_importlibs(rosperf version msimg32 gdi32 shell32 advapi32 user32 ntdll msvcrt
kernel32)
add_cd_file(TARGET rosperf DESTINATION reactos/system32 FOR all)
diff --git a/modules/rosapps/templates/dialog/CMakeLists.txt
b/modules/rosapps/templates/dialog/CMakeLists.txt
index 16aed4a4261..2451bd065cf 100644
--- a/modules/rosapps/templates/dialog/CMakeLists.txt
+++ b/modules/rosapps/templates/dialog/CMakeLists.txt
@@ -9,8 +9,8 @@ list(APPEND SOURCE
add_executable(template_dialog ${SOURCE} dialog.rc)
set_module_type(template_dialog win32cui)
-if(NOT MSVC)
- target_compile_options(template_dialog PRIVATE
"-Wno-unused-but-set-variable")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(template_dialog PRIVATE -Wno-unused-but-set-variable)
endif()
add_importlibs(template_dialog user32 gdi32 comctl32 msvcrt kernel32 ntdll)
add_cd_file(TARGET template_dialog DESTINATION reactos/system32 FOR all)
diff --git a/modules/rostests/winetests/advpack/CMakeLists.txt
b/modules/rostests/winetests/advpack/CMakeLists.txt
index 9eebedf7ba0..097c91f79a5 100644
--- a/modules/rostests/winetests/advpack/CMakeLists.txt
+++ b/modules/rostests/winetests/advpack/CMakeLists.txt
@@ -9,7 +9,7 @@ add_executable(advpack_winetest ${SOURCE})
target_compile_definitions(advpack_winetest PRIVATE USE_WINE_TODOS)
-if (NOT MSVC)
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(advpack_winetest PRIVATE -Wno-format-overflow)
endif()
diff --git a/modules/rostests/winetests/fusion/CMakeLists.txt
b/modules/rostests/winetests/fusion/CMakeLists.txt
index f3600c383d0..4654753fa9b 100644
--- a/modules/rostests/winetests/fusion/CMakeLists.txt
+++ b/modules/rostests/winetests/fusion/CMakeLists.txt
@@ -10,7 +10,7 @@ add_executable(fusion_winetest ${SOURCE})
target_compile_definitions(fusion_winetest PRIVATE USE_WINE_TODOS)
-if (NOT MSVC)
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(fusion_winetest PRIVATE -Wno-format-overflow)
endif()
diff --git a/modules/rostests/winetests/msi/CMakeLists.txt
b/modules/rostests/winetests/msi/CMakeLists.txt
index 815c2cfc2cc..8884c47513c 100644
--- a/modules/rostests/winetests/msi/CMakeLists.txt
+++ b/modules/rostests/winetests/msi/CMakeLists.txt
@@ -32,7 +32,7 @@ add_executable(msi_winetest
target_compile_definitions(msi_winetest PRIVATE __WINESRC__ USE_WINE_TODOS)
-if (NOT MSVC)
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(msi_winetest PRIVATE -Wno-format-overflow)
endif()
diff --git a/modules/rostests/winetests/ole32/CMakeLists.txt
b/modules/rostests/winetests/ole32/CMakeLists.txt
index dd2aa62975d..37c0d4aa520 100644
--- a/modules/rostests/winetests/ole32/CMakeLists.txt
+++ b/modules/rostests/winetests/ole32/CMakeLists.txt
@@ -30,7 +30,9 @@ add_importlibs(ole32_winetest oleaut32 ole32 user32 gdi32 advapi32
msvcrt kernel
if(MSVC)
add_importlibs(ole32_winetest ntdll)
-else()
+endif()
+
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(ole32_winetest PRIVATE -Wno-format-overflow)
endif()
diff --git a/modules/rostests/winetests/services/CMakeLists.txt
b/modules/rostests/winetests/services/CMakeLists.txt
index b6313f4d2e8..a7051a0f91e 100644
--- a/modules/rostests/winetests/services/CMakeLists.txt
+++ b/modules/rostests/winetests/services/CMakeLists.txt
@@ -4,6 +4,6 @@ set_module_type(services_winetest win32cui)
add_importlibs(services_winetest user32 advapi32 msvcrt kernel32)
add_rostests_file(TARGET services_winetest)
-if (NOT MSVC)
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(services_winetest PRIVATE -Wno-format-overflow)
endif()
diff --git a/modules/rostests/winetests/setupapi/CMakeLists.txt
b/modules/rostests/winetests/setupapi/CMakeLists.txt
index 60ba1fef77b..7233a7900b1 100644
--- a/modules/rostests/winetests/setupapi/CMakeLists.txt
+++ b/modules/rostests/winetests/setupapi/CMakeLists.txt
@@ -17,6 +17,6 @@ target_link_libraries(setupapi_winetest uuid)
add_importlibs(setupapi_winetest advapi32 setupapi user32 shell32 msvcrt kernel32 ntdll)
add_rostests_file(TARGET setupapi_winetest)
-if (NOT MSVC)
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(setupapi_winetest PRIVATE -Wno-format-overflow)
endif()
diff --git a/modules/rostests/winetests/shell32/CMakeLists.txt
b/modules/rostests/winetests/shell32/CMakeLists.txt
index a9816a60be4..23dcd7c751b 100644
--- a/modules/rostests/winetests/shell32/CMakeLists.txt
+++ b/modules/rostests/winetests/shell32/CMakeLists.txt
@@ -38,7 +38,9 @@ add_importlibs(shell32_winetest shell32 shlwapi ole32 oleaut32 user32
gdi32 adva
if(MSVC)
add_importlibs(shell32_winetest ntdll)
-else()
+endif()
+
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(shell32_winetest PRIVATE -Wno-format-overflow)
endif()
diff --git a/modules/rostests/winetests/user32/CMakeLists.txt
b/modules/rostests/winetests/user32/CMakeLists.txt
index 132170024a8..32f89934309 100644
--- a/modules/rostests/winetests/user32/CMakeLists.txt
+++ b/modules/rostests/winetests/user32/CMakeLists.txt
@@ -40,7 +40,9 @@ add_executable(user32_winetest
if(MSVC)
# Disable warning C4477 (printf format warnings)
remove_target_compile_option(user32_winetest "/we4477")
-elseif(GCC)
+endif()
+
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(user32_winetest PRIVATE -Wno-format-overflow)
endif()
diff --git a/modules/rostests/winetests/version/CMakeLists.txt
b/modules/rostests/winetests/version/CMakeLists.txt
index a4d8a7901e2..f472718d44b 100644
--- a/modules/rostests/winetests/version/CMakeLists.txt
+++ b/modules/rostests/winetests/version/CMakeLists.txt
@@ -10,10 +10,12 @@ add_importlibs(version_winetest shell32 version msvcrt kernel32)
target_compile_definitions(version_winetest PRIVATE USE_WINE_TODOS)
-if (NOT MSVC)
- target_compile_options(version_winetest PRIVATE -Wno-format-overflow)
-else()
+if(MSVC)
add_importlibs(version_winetest ntdll)
endif()
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(version_winetest PRIVATE -Wno-format-overflow)
+endif()
+
add_rostests_file(TARGET version_winetest)
diff --git a/sdk/lib/3rdparty/adns/CMakeLists.txt b/sdk/lib/3rdparty/adns/CMakeLists.txt
index d46b9e4cdfa..34b0deeafd8 100644
--- a/sdk/lib/3rdparty/adns/CMakeLists.txt
+++ b/sdk/lib/3rdparty/adns/CMakeLists.txt
@@ -24,8 +24,8 @@ list(APPEND SOURCE
add_library(adns ${SOURCE})
-if(NOT MSVC)
- target_compile_options(adns PRIVATE "-Wno-unused-but-set-variable")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(adns PRIVATE -Wno-unused-but-set-variable)
endif()
add_dependencies(adns psdk)
diff --git a/sdk/lib/3rdparty/cardlib/CMakeLists.txt
b/sdk/lib/3rdparty/cardlib/CMakeLists.txt
index 1a90575b34b..b35c25d8046 100644
--- a/sdk/lib/3rdparty/cardlib/CMakeLists.txt
+++ b/sdk/lib/3rdparty/cardlib/CMakeLists.txt
@@ -18,8 +18,8 @@ add_library(cardlib STATIC ${SOURCE})
target_link_libraries(cardlib PRIVATE cpprt)
target_include_directories(cardlib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
-if(NOT MSVC)
- target_compile_options(cardlib PRIVATE "-Wno-unused-but-set-variable")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(cardlib PRIVATE -Wno-unused-but-set-variable)
endif()
add_dependencies(cardlib psdk)