mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[CMAKE] Elimitate the use of GCC and CLANG variables
This commit is contained in:
parent
6f4be52a1c
commit
f155b9377f
32 changed files with 78 additions and 116 deletions
|
@ -76,8 +76,7 @@ add_definitions(
|
|||
|
||||
# There doesn't seem to be a standard for __FILE__ being relative or absolute, so detect it at runtime.
|
||||
file(RELATIVE_PATH _PATH_PREFIX ${REACTOS_BINARY_DIR} ${REACTOS_SOURCE_DIR})
|
||||
if (GCC AND ((CMAKE_C_COMPILER_ID STREQUAL "GNU") AND (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "8.0.0")
|
||||
OR ((CMAKE_C_COMPILER_ID STREQUAL "Clang") AND (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "10.0.0"))))
|
||||
if (NOT MSVC AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang"))
|
||||
# Thankfully, GCC has this
|
||||
add_compile_options(-ffile-prefix-map=${REACTOS_SOURCE_DIR}=)
|
||||
add_compile_options(-ffile-prefix-map=${_PATH_PREFIX}=)
|
||||
|
@ -229,7 +228,7 @@ Enable this if the module uses typeid or dynamic_cast. You will probably need to
|
|||
message(WARNING "-- Disabling precompiled headers support (ccache).")
|
||||
option(PCH "Whether to use precompiled headers" OFF)
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
||||
elseif(GCC)
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
message(WARNING "-- Disabling precompiled headers on GCC by default CORE-17108.")
|
||||
option(PCH "Whether to use precompiled headers" OFF)
|
||||
else()
|
||||
|
|
|
@ -48,7 +48,7 @@ list(APPEND SOURCE
|
|||
|
||||
add_executable(nfsd ${SOURCE} nfsd.rc)
|
||||
|
||||
if(MSVC AND (NOT USE_CLANG_CL))
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
|
||||
# Disable warning C4477 (printf format warnings)
|
||||
target_compile_options(nfsd PRIVATE /wd4477)
|
||||
else()
|
||||
|
|
|
@ -7,7 +7,7 @@ add_definitions(
|
|||
set(NTOS_RTL_SOURCE_DIR "${REACTOS_SOURCE_DIR}/sdk/lib/rtl")
|
||||
include_directories(${NTOS_RTL_SOURCE_DIR})
|
||||
|
||||
if (GCC)
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
# Enable this again. CORE-17637
|
||||
add_compile_options(-Wunused-result)
|
||||
endif()
|
||||
|
|
2
dll/3rdparty/libxslt/CMakeLists.txt
vendored
2
dll/3rdparty/libxslt/CMakeLists.txt
vendored
|
@ -43,7 +43,7 @@ if(MSVC)
|
|||
add_importlibs(libxslt ntdll)
|
||||
endif()
|
||||
|
||||
if(GCC OR CLANG)
|
||||
if(NOT MSVC)
|
||||
target_compile_options(libxslt PRIVATE -Wno-misleading-indentation -Wno-pointer-sign -Wno-unused-function)
|
||||
endif()
|
||||
|
||||
|
|
4
dll/3rdparty/mbedtls/CMakeLists.txt
vendored
4
dll/3rdparty/mbedtls/CMakeLists.txt
vendored
|
@ -102,6 +102,8 @@ add_cd_file(TARGET mbedtls DESTINATION reactos/system32 FOR all)
|
|||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(mbedtls PRIVATE -Wno-pointer-sign -Wno-unused-function)
|
||||
elseif(USE_CLANG_CL)
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(mbedtls PRIVATE -Wno-tautological-constant-compare)
|
||||
endif()
|
||||
|
|
|
@ -120,19 +120,19 @@ target_link_libraries(glu32 cpprt)
|
|||
|
||||
set_module_type(glu32 win32dll)
|
||||
|
||||
if(NOT MSVC)
|
||||
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-write-strings)
|
||||
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()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(glu32 PRIVATE -Wno-write-strings)
|
||||
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()
|
||||
|
||||
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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
if (NOT (GCC AND (ARCH STREQUAL "amd64")))
|
||||
if (MSVC OR ARCH STREQUAL "i386")
|
||||
#FIXME _setjmp definitions in CRT headers is wrong
|
||||
add_subdirectory(ms)
|
||||
list(APPEND SOURCE ms_seh.c)
|
||||
|
@ -12,7 +12,7 @@ list(APPEND SOURCE
|
|||
testlist.c)
|
||||
|
||||
add_executable(compiler_apitest ${SOURCE})
|
||||
if (NOT (GCC AND (ARCH STREQUAL "amd64")))
|
||||
if (MSVC OR ARCH STREQUAL "i386")
|
||||
target_link_libraries(compiler_apitest ms_seh_test)
|
||||
endif()
|
||||
target_link_libraries(compiler_apitest wine ${PSEH_LIB})
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
if (GCC)
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
add_compile_options(-fno-builtin)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ add_executable(advapi32_winetest
|
|||
${SOURCE}
|
||||
${PCH_SKIP_SOURCE})
|
||||
|
||||
if(USE_CLANG_CL OR (NOT MSVC))
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(advapi32_winetest PRIVATE "-Wno-format")
|
||||
endif()
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ if(MSVC)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_CLANG_CL OR (NOT MSVC))
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(kernel32_winetest PRIVATE "-Wno-format")
|
||||
endif()
|
||||
|
||||
|
|
|
@ -27,11 +27,8 @@ target_compile_definitions(msvcrt_winetest PRIVATE
|
|||
_CRT_NONSTDC_NO_DEPRECATE
|
||||
__msvcrt_ulong=ULONG)
|
||||
|
||||
if ((NOT MSVC) OR USE_CLANG_CL)
|
||||
if (NOT USE_CLANG_CL)
|
||||
target_compile_options(msvcrt_winetest PRIVATE -Wno-stringop-truncation)
|
||||
endif()
|
||||
target_compile_options(msvcrt_winetest PRIVATE -Wno-format)
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(msvcrt_winetest PRIVATE -Wno-format -Wno-stringop-truncation)
|
||||
endif()
|
||||
|
||||
set_module_type(msvcrt_winetest win32cui)
|
||||
|
|
|
@ -40,7 +40,7 @@ if(MSVC AND ARCH STREQUAL "amd64")
|
|||
target_compile_options(ntdll_winetest PRIVATE /wd4334)
|
||||
endif()
|
||||
|
||||
if(USE_CLANG_CL OR (NOT MSVC))
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(ntdll_winetest PRIVATE "-Wno-format")
|
||||
endif()
|
||||
|
||||
|
|
|
@ -40,11 +40,12 @@ endif()
|
|||
|
||||
add_executable(rpcrt4_winetest ${SOURCE})
|
||||
|
||||
if(USE_CLANG_CL OR (NOT MSVC))
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(rpcrt4_winetest PRIVATE "-Wno-format")
|
||||
if(USE_CLANG_CL)
|
||||
target_compile_options(rpcrt4_winetest PRIVATE "-Wno-cast-calling-convention")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(rpcrt4_winetest PRIVATE "-Wno-cast-calling-convention")
|
||||
endif()
|
||||
|
||||
target_link_libraries(rpcrt4_winetest uuid wine ${PSEH_LIB})
|
||||
|
|
|
@ -14,7 +14,7 @@ list(APPEND SOURCE
|
|||
|
||||
add_executable(winmm_winetest ${SOURCE})
|
||||
|
||||
if(USE_CLANG_CL OR (NOT MSVC))
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(winmm_winetest PRIVATE "-Wno-format")
|
||||
endif()
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ include_directories(BEFORE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
|
|||
|
||||
add_executable(ws2_32_winetest protocol.c sock.c testlist.c)
|
||||
|
||||
if(USE_CLANG_CL OR (NOT MSVC))
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(ws2_32_winetest PRIVATE "-Wno-format")
|
||||
endif()
|
||||
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
|
||||
PROJECT(NTOS)
|
||||
|
||||
if (GCC)
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
# Enable this again. CORE-17637
|
||||
add_compile_options(-Wunused-result)
|
||||
endif()
|
||||
|
||||
include(ntos.cmake)
|
||||
|
||||
if(NOT MSVC)
|
||||
# Make sure we don't duplicate some symbols
|
||||
add_compile_options(-fno-common)
|
||||
endif()
|
||||
|
||||
set(NTOSKRNL_SOURCE ${SOURCE})
|
||||
set(NTOSKRNL_ASM_SOURCE ${ASM_SOURCE})
|
||||
|
||||
|
|
|
@ -75,25 +75,6 @@ else()
|
|||
"Whether to compile for debugging.")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
set(GCC TRUE CACHE BOOL "The compiler is GCC")
|
||||
set(CLANG FALSE CACHE BOOL "The compiler is LLVM Clang")
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
# We can use LLVM Clang mimicking CL or GCC. Account for this
|
||||
if (MSVC)
|
||||
set(GCC FALSE CACHE BOOL "The compiler is GCC")
|
||||
else()
|
||||
set(GCC TRUE CACHE BOOL "The compiler is GCC")
|
||||
endif()
|
||||
set(CLANG TRUE CACHE BOOL "The compiler is LLVM Clang")
|
||||
elseif(MSVC) # aka CMAKE_C_COMPILER_ID STREQUAL "MSVC"
|
||||
set(GCC FALSE CACHE BOOL "The compiler is GCC")
|
||||
set(CLANG FALSE CACHE BOOL "The compiler is LLVM Clang")
|
||||
# MSVC variable is already set by cmake
|
||||
else()
|
||||
message("WARNING: the compiler has not been recognized")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
set(KDBG FALSE CACHE BOOL
|
||||
"Whether to compile in the integrated kernel debugger.")
|
||||
|
@ -102,7 +83,6 @@ if(MSVC)
|
|||
else()
|
||||
set(_WINKD_ TRUE CACHE BOOL "Whether to compile with the KD protocol.")
|
||||
endif()
|
||||
|
||||
else()
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
set(KDBG FALSE CACHE BOOL "Whether to compile in the integrated kernel debugger.")
|
||||
|
@ -120,7 +100,7 @@ cmake_dependent_option(ISAPNP_ENABLE "Whether to enable the ISA PnP support." ON
|
|||
set(GENERATE_DEPENDENCY_GRAPH FALSE CACHE BOOL
|
||||
"Whether to create a GraphML dependency graph of DLLs.")
|
||||
|
||||
if(MSVC)
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
|
||||
option(_PREFAST_ "Whether to enable PREFAST while compiling." OFF)
|
||||
option(_VS_ANALYZE_ "Whether to enable static analysis while compiling." OFF)
|
||||
# RTC are incompatible with compiler optimizations.
|
||||
|
@ -128,7 +108,7 @@ if(MSVC)
|
|||
"CMAKE_BUILD_TYPE STREQUAL Debug" OFF)
|
||||
endif()
|
||||
|
||||
if(GCC)
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
option(STACK_PROTECTOR "Whether to enable the GCC stack checker while compiling" OFF)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -485,12 +485,12 @@ add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:$<IF:$<BOOL:$<TARGET_PROPERTY:WIT
|
|||
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:$<IF:$<BOOL:$<TARGET_PROPERTY:WITH_CXX_EXCEPTIONS>>,-fexceptions,-fno-exceptions>>")
|
||||
|
||||
# G++ shipped with ROSBE uses sjlj exceptions on i386. Tell Clang it is so
|
||||
if (CLANG AND (ARCH STREQUAL "i386"))
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ARCH STREQUAL "i386")
|
||||
add_compile_options("$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<BOOL:$<TARGET_PROPERTY:WITH_CXX_EXCEPTIONS>>>:-fsjlj-exceptions>")
|
||||
endif()
|
||||
|
||||
# Find default G++ libraries
|
||||
if (CLANG)
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
set(GXX_EXECUTABLE ${CMAKE_CXX_COMPILER_TARGET}-g++)
|
||||
else()
|
||||
set(GXX_EXECUTABLE ${CMAKE_CXX_COMPILER})
|
||||
|
|
4
sdk/lib/3rdparty/freetype/CMakeLists.txt
vendored
4
sdk/lib/3rdparty/freetype/CMakeLists.txt
vendored
|
@ -58,6 +58,8 @@ add_library(freetype ${SOURCE})
|
|||
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND ARCH STREQUAL "amd64")
|
||||
# error C4312: 'type cast': conversion from 'unsigned long' to 'void *' of greater size
|
||||
remove_target_compile_option(freetype "/we4312")
|
||||
elseif(GCC)
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(freetype PRIVATE -fno-builtin-malloc)
|
||||
endif()
|
||||
|
|
2
sdk/lib/3rdparty/libxml2/CMakeLists.txt
vendored
2
sdk/lib/3rdparty/libxml2/CMakeLists.txt
vendored
|
@ -64,7 +64,7 @@ list(APPEND SOURCE
|
|||
|
||||
add_library(libxml2 ${SOURCE})
|
||||
|
||||
if(MSVC AND (NOT USE_CLANG_CL))
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
|
||||
# Unreferenced local variable
|
||||
remove_target_compile_option(libxml2 "/we4101")
|
||||
target_compile_options(libxml2 PRIVATE "/wd4101")
|
||||
|
|
|
@ -26,7 +26,7 @@ if(ARCH STREQUAL "i386")
|
|||
math/i386/alldiv_asm.s
|
||||
math/i386/aulldiv_asm.s
|
||||
)
|
||||
if (GCC AND CLANG)
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT MSVC)
|
||||
list(APPEND MSVCRTEX_ASM_SOURCE
|
||||
math/i386/ceilf.S
|
||||
math/i386/floorf.S)
|
||||
|
@ -77,7 +77,7 @@ if(MSVC AND (ARCH STREQUAL "i386"))
|
|||
endif()
|
||||
|
||||
|
||||
if(GCC OR CLANG)
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(msvcrtex PRIVATE $<$<COMPILE_LANGUAGE:C>:-Wno-main>)
|
||||
if(LTCG)
|
||||
target_compile_options(msvcrtex PRIVATE -fno-lto)
|
||||
|
|
|
@ -210,7 +210,7 @@ target_include_directories(wdf01000
|
|||
|
||||
target_link_libraries(wdf01000 aux_klib ntoskrnl_vista ${PSEH_LIB})
|
||||
|
||||
if(GCC)
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(wdf01000
|
||||
PRIVATE -Wno-write-strings -Wno-unknown-pragmas -Wno-switch
|
||||
PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wno-reorder -Wno-invalid-offsetof -Wno-delete-non-virtual-dtor>)
|
||||
|
|
|
@ -5,7 +5,7 @@ add_definitions(
|
|||
-D_NTSYSTEM_
|
||||
-D_NTDLLBUILD_)
|
||||
|
||||
if (GCC)
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
# Enable this again. CORE-17637
|
||||
add_compile_options(-Wunused-result)
|
||||
endif()
|
||||
|
|
Loading…
Reference in a new issue