[CMAKE] Do not use USE_CLANG_CL variable in CMake scripts

This commit is contained in:
Victor Perevertkin 2022-05-26 02:03:50 +03:00
parent f155b9377f
commit 447ef2aa4a
No known key found for this signature in database
GPG key ID: C750B7222E9C7830
14 changed files with 23 additions and 24 deletions

View file

@ -245,7 +245,8 @@ Enable this if the module uses typeid or dynamic_cast. You will probably need to
# Arch Options
if(ARCH STREQUAL "i386")
if(NOT USE_CLANG_CL)
# clang-cl defines this one for itself
if(NOT (MSVC AND CMAKE_C_COMPILER_ID STREQUAL "Clang"))
add_definitions(-D_M_IX86)
endif()
add_definitions(-D_X86_ -D__i386__ -Di386)

View file

@ -10,9 +10,7 @@ add_subdirectory(netstat)
add_subdirectory(nslookup)
add_subdirectory(ping)
add_subdirectory(route)
if(NOT USE_CLANG_CL)
add_subdirectory(telnet)
endif()
add_subdirectory(tracert)
add_subdirectory(whois)
add_subdirectory(wlanconf)

View file

@ -35,7 +35,7 @@ if (NOT MSVC)
target_compile_definitions(telnet PRIVATE _CRT_NONSTDC_NO_DEPRECATE)
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(telnet PRIVATE -Wno-restrict $<$<COMPILE_LANGUAGE:CXX>:-Wno-narrowing>)
endif()

View file

@ -16,7 +16,7 @@ list(APPEND SOURCE
include_directories(${REACTOS_BINARY_DIR}/sdk/include/reactos/wine)
add_executable(rpcss ${SOURCE} rpcss.rc)
if(USE_CLANG_CL)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(rpcss PRIVATE "-Wno-cast-calling-convention")
endif()

View file

@ -10,7 +10,7 @@ list(APPEND SOURCE
add_executable(wlansvc ${SOURCE} wlansvc.rc)
if(USE_CLANG_CL)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(wlansvc PRIVATE "-Wno-cast-calling-convention")
endif()

View file

@ -30,7 +30,7 @@ list(APPEND SOURCE
add_executable(usetup ${SOURCE} usetup.rc)
if(USE_CLANG_CL)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(usetup PRIVATE "-Wno-invalid-source-encoding")
endif()

View file

@ -211,7 +211,7 @@ add_library(freeldr_common
${FREELDR_NTLDR_SOURCE}
${FREELDR_BOOTMGR_SOURCE})
if(USE_CLANG_CL)
if(MSVC AND CMAKE_C_COMPILER_ID STREQUAL "Clang")
# We need to reduce the binary size
target_compile_options(freeldr_common PRIVATE "/Os")
endif()
@ -219,7 +219,7 @@ if(NOT MSVC AND ARCH STREQUAL "i386" AND SARCH STREQUAL "xbox")
# Prevent a warning when doing a memcmp with address 0
set_source_files_properties(arch/i386/xbox/xboxmem.c PROPERTIES COMPILE_FLAGS "-Wno-nonnull")
endif()
if(ARCH STREQUAL "amd64" AND NOT MSVC)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
# Prevent using SSE (not support in freeldr)
target_compile_options(freeldr_common PUBLIC -mno-sse)
endif()

View file

@ -97,7 +97,7 @@ if(MSVC)
# 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)
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
target_compile_options(libtirpc PRIVATE /wd4101 /wd4133 /wd4473 /wd4477)
endif()
else()

View file

@ -56,7 +56,7 @@ add_library(portcls MODULE
portcls.rc
${CMAKE_CURRENT_BINARY_DIR}/portcls.def)
if(USE_CLANG_CL)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(portcls PRIVATE "-Wno-missing-braces")
endif()

View file

@ -33,14 +33,14 @@ endif()
add_definitions(/D__STDC__=1)
# Ignore any "standard" include paths, and do not use any default CRT library.
if(NOT USE_CLANG_CL)
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
add_compile_options(/X /Zl)
endif()
# Disable buffer security checks by default.
add_compile_options(/GS-)
if(USE_CLANG_CL)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CL_SHOWINCLUDES_PREFIX "Note: including file: ")
endif()
@ -48,7 +48,7 @@ endif()
# default for older compilers. See CORE-6507
if(ARCH STREQUAL "i386")
# Clang's IA32 means i386, which doesn't have cmpxchg8b
if(USE_CLANG_CL)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_compile_options(-march=${OARCH})
else()
add_compile_options(/arch:IA32)
@ -93,7 +93,7 @@ if (MSVC_IDE)
endif()
# On x86 Debug builds, if it's not Clang-CL or msbuild, treat all warnings as errors
if ((ARCH STREQUAL "i386") AND (CMAKE_BUILD_TYPE STREQUAL "Debug") AND (NOT USE_CLANG_CL) AND (NOT MSVC_IDE))
if ((ARCH STREQUAL "i386") AND (CMAKE_BUILD_TYPE STREQUAL "Debug") AND (CMAKE_C_COMPILER_ID STREQUAL "MSVC") AND (NOT MSVC_IDE))
set(TREAT_ALL_WARNINGS_AS_ERRORS=TRUE)
endif()
@ -140,7 +140,7 @@ endif()
# - C4115: named type definition in parentheses
add_compile_options(/w14115)
if(USE_CLANG_CL)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_compile_options("$<$<COMPILE_LANGUAGE:C,CXX>:-nostdinc;-Wno-multichar;-Wno-char-subscripts;-Wno-microsoft-enum-forward-reference;-Wno-pragma-pack;-Wno-microsoft-anon-tag;-Wno-parentheses-equality;-Wno-unknown-pragmas>")
endif()
@ -152,7 +152,7 @@ add_compile_definitions($<$<CONFIG:Release>:NDEBUG>)
# Hotpatchable images
if(ARCH STREQUAL "i386")
if(NOT USE_CLANG_CL)
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
add_compile_options(/hotpatch)
endif()
set(_hotpatch_link_flag "/FUNCTIONPADMIN:5")
@ -432,7 +432,7 @@ function(CreateBootSectorTarget _target_name _asm_file _binary_file _base_addres
get_defines(_defines)
get_includes(_includes)
if(USE_CLANG_CL)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(_no_std_includes_flag "-nostdinc")
else()
set(_no_std_includes_flag "/X")
@ -519,7 +519,7 @@ function(add_linker_script _target _linker_script_file)
# Create the additional linker response file.
set(_generated_file "${_generated_file_path_prefix}.rsp")
if(USE_CLANG_CL)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(_no_std_includes_flag "-nostdinc")
else()
set(_no_std_includes_flag "/X")

View file

@ -40,7 +40,7 @@ add_library(stlport
src/cxa.c
src/c_locale.c)
if(USE_CLANG_CL)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(stlport PRIVATE -Wno-missing-braces -Wno-unused-local-typedef)
target_compile_options(stlport PRIVATE -Wno-infinite-recursion -Wno-deprecated-register)
target_compile_options(stlport PRIVATE -Wno-tautological-unsigned-zero-compare)

View file

@ -32,7 +32,7 @@ list(APPEND CRT_STDLIB_SOURCE
stdlib/wmakpath_s.c
)
if(USE_CLANG_CL)
if(MSVC AND CMAKE_C_COMPILER_ID STREQUAL "Clang")
if(ARCH STREQUAL "i386")
list(APPEND CRT_STDLIB_ASM_SOURCE
stdlib/clang-alias.s

View file

@ -100,7 +100,7 @@ function(add_asm16_bin _target _binary_file _base_address)
##
## All this part is the same as CreateBootSectorTarget
##
if(USE_CLANG_CL)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(_no_std_includes_flag "-nostdinc")
else()
set(_no_std_includes_flag "/X")

View file

@ -35,7 +35,7 @@ set_target_properties(spoolsv
ENABLE_EXPORTS TRUE
DEFINE_SYMBOL "")
if(USE_CLANG_CL)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(spoolsv PRIVATE "-Wno-cast-calling-convention")
endif()