[CMAKE] Elimitate the use of GCC and CLANG variables

This commit is contained in:
Victor Perevertkin 2022-05-26 01:37:23 +03:00
parent 6f4be52a1c
commit f155b9377f
No known key found for this signature in database
GPG key ID: C750B7222E9C7830
32 changed files with 78 additions and 116 deletions

View file

@ -88,26 +88,21 @@ list(APPEND SOURCE
add_library(ext2fs MODULE ${SOURCE} ext2fs.rc)
if(MSVC)
if (NOT CLANG)
# 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
-Wno-pointer-sign -Wno-unused-function
-Wno-unused-variable -Wno-missing-braces)
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
# 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()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(ext2fs PRIVATE -Wno-unused-but-set-variable)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(ext2fs PRIVATE
-Wno-pointer-sign -Wno-unused-function -Wno-unused-variable -Wno-missing-braces -Wno-unused-but-set-variable)
endif()
if(CLANG)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(ext2fs PRIVATE
-Wno-unused-value -Wno-parentheses-equality
-Wno-parentheses-equality
-Wno-incompatible-pointer-types-discards-qualifiers
"-Wno-#pragma-messages;-Wno-cast-calling-convention")
endif()

View file

@ -38,7 +38,7 @@ list(APPEND SOURCE
add_library(fastfat MODULE ${SOURCE} fastfat.rc)
set_module_type(fastfat kernelmodedriver)
target_link_libraries(fastfat ${PSEH_LIB} memcmp)
if(GDB AND NOT CLANG)
if(GDB AND NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(fastfat PRIVATE -O0)
endif()
add_importlibs(fastfat ntoskrnl hal)

View file

@ -14,12 +14,14 @@ set_module_type(nfs41_driver kernelmodedriver)
target_link_libraries(nfs41_driver ntoskrnl_vista rdbsslib rxce copysup memcmp ${PSEH_LIB})
add_importlibs(nfs41_driver ntoskrnl hal)
if(GCC OR CLANG)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(nfs41_driver PRIVATE "-Wno-switch")
if(CLANG)
target_compile_options(nfs41_driver PRIVATE "-Wno-unused-value")
endif()
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(nfs41_driver PRIVATE "-Wno-unused-value")
endif()
set_property(TARGET nfs41_driver PROPERTY C_STANDARD 90)
add_cd_file(TARGET nfs41_driver DESTINATION reactos/system32/drivers FOR all)

View file

@ -41,19 +41,17 @@ list(APPEND SOURCE
add_library(udfs MODULE ${SOURCE} udffs.rc)
if(MSVC)
if(USE_CLANG_CL)
target_compile_options(udfs PRIVATE -Wno-extern-c-compat -Wno-unused-value)
target_compile_options(udfs PRIVATE -Wno-tautological-constant-out-of-range-compare)
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()
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(udfs PRIVATE -Wno-unused-but-set-variable)
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(udfs PRIVATE -Wno-extern-c-compat -Wno-unused-value)
target_compile_options(udfs PRIVATE -Wno-tautological-constant-out-of-range-compare)
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()
set_module_type(udfs kernelmodedriver)
target_link_libraries(udfs ${PSEH_LIB})
add_importlibs(udfs ntoskrnl hal)

View file

@ -20,15 +20,12 @@ list(APPEND SOURCE
add_library(cdrom MODULE ${SOURCE} cdrom.rc)
set_module_type(cdrom kernelmodedriver)
if(GCC OR CLANG)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(cdrom PRIVATE -Wno-format -Wno-unused-variable -Wno-pointer-sign)
endif()
if(GCC)
target_compile_options(cdrom PRIVATE -Wno-unknown-pragmas -Wno-incompatible-pointer-types -Wno-switch)
endif()
if(CLANG)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(cdrom PRIVATE -Wno-enum-conversion -Wno-tautological-constant-compare)
endif()

View file

@ -41,7 +41,7 @@ target_compile_definitions(classpnp PRIVATE
CLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFER_SIZE=512
CLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFERS=512)
if(GCC)
if(NOT MSVC)
target_compile_options(classpnp PRIVATE -Wno-pointer-to-int-cast -Wno-switch)
endif()

View file

@ -16,11 +16,8 @@ target_compile_definitions(disk PUBLIC
_WIN32_WINNT=0x602
NTDDI_VERSION=0x06020000) # NTDDI_WIN8
if(USE_CLANG_CL OR (NOT MSVC))
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(disk PRIVATE -Wno-format -Wno-pointer-sign)
endif()
if(GCC)
target_compile_options(disk PRIVATE -Wno-pointer-to-int-cast -Wno-switch)
endif()

View file

@ -21,21 +21,18 @@ list(APPEND SOURCE
add_library(uniata MODULE ${SOURCE} idedma.rc)
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")
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)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(uniata PRIVATE -Wno-narrowing -Wno-unused-but-set-variable)
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(uniata PRIVATE -Wno-unused-const-variable)
endif()
add_pch(uniata stdafx.h SOURCE)

View file

@ -26,7 +26,7 @@ target_link_libraries(cmipci stdunk libcntpr uuid)
set_module_type(cmipci wdmdriver UNICODE)
add_importlibs(cmipci portcls hal ntoskrnl)
if(USE_CLANG_CL OR (NOT MSVC))
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(cmipci PRIVATE -Wno-write-strings -Wno-switch)
endif()