From 447ef2aa4a15adfb4060b72383a34001a14d13ac Mon Sep 17 00:00:00 2001 From: Victor Perevertkin Date: Thu, 26 May 2022 02:03:50 +0300 Subject: [PATCH] [CMAKE] Do not use USE_CLANG_CL variable in CMake scripts --- CMakeLists.txt | 3 ++- base/applications/network/CMakeLists.txt | 4 +--- base/applications/network/telnet/CMakeLists.txt | 2 +- base/services/rpcss/CMakeLists.txt | 2 +- base/services/wlansvc/CMakeLists.txt | 2 +- base/setup/usetup/CMakeLists.txt | 2 +- boot/freeldr/freeldr/CMakeLists.txt | 4 ++-- dll/3rdparty/libtirpc/CMakeLists.txt | 2 +- drivers/wdm/audio/backpln/portcls/CMakeLists.txt | 2 +- sdk/cmake/msvc.cmake | 16 ++++++++-------- sdk/lib/3rdparty/stlport/CMakeLists.txt | 2 +- sdk/lib/crt/stdlib/stdlib.cmake | 2 +- subsystems/mvdm/asm16.cmake | 2 +- win32ss/printing/base/spoolsv/CMakeLists.txt | 2 +- 14 files changed, 23 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 40adc041d20..2b05726a694 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/base/applications/network/CMakeLists.txt b/base/applications/network/CMakeLists.txt index 46246108408..4f95614999e 100644 --- a/base/applications/network/CMakeLists.txt +++ b/base/applications/network/CMakeLists.txt @@ -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(telnet) add_subdirectory(tracert) add_subdirectory(whois) add_subdirectory(wlanconf) diff --git a/base/applications/network/telnet/CMakeLists.txt b/base/applications/network/telnet/CMakeLists.txt index 1af3dfefe26..8d0de5ac306 100644 --- a/base/applications/network/telnet/CMakeLists.txt +++ b/base/applications/network/telnet/CMakeLists.txt @@ -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 $<$:-Wno-narrowing>) endif() diff --git a/base/services/rpcss/CMakeLists.txt b/base/services/rpcss/CMakeLists.txt index 347356773c3..a8141072143 100644 --- a/base/services/rpcss/CMakeLists.txt +++ b/base/services/rpcss/CMakeLists.txt @@ -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() diff --git a/base/services/wlansvc/CMakeLists.txt b/base/services/wlansvc/CMakeLists.txt index 0ac461728e5..f1023aff221 100644 --- a/base/services/wlansvc/CMakeLists.txt +++ b/base/services/wlansvc/CMakeLists.txt @@ -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() diff --git a/base/setup/usetup/CMakeLists.txt b/base/setup/usetup/CMakeLists.txt index 35d4ac099ee..1ef57a42082 100644 --- a/base/setup/usetup/CMakeLists.txt +++ b/base/setup/usetup/CMakeLists.txt @@ -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() diff --git a/boot/freeldr/freeldr/CMakeLists.txt b/boot/freeldr/freeldr/CMakeLists.txt index 00d6dc8271b..c00416befbc 100644 --- a/boot/freeldr/freeldr/CMakeLists.txt +++ b/boot/freeldr/freeldr/CMakeLists.txt @@ -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() diff --git a/dll/3rdparty/libtirpc/CMakeLists.txt b/dll/3rdparty/libtirpc/CMakeLists.txt index 0975514febf..a0cb36ce8eb 100644 --- a/dll/3rdparty/libtirpc/CMakeLists.txt +++ b/dll/3rdparty/libtirpc/CMakeLists.txt @@ -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() diff --git a/drivers/wdm/audio/backpln/portcls/CMakeLists.txt b/drivers/wdm/audio/backpln/portcls/CMakeLists.txt index a873b75fe2a..a2bd9b19d4e 100644 --- a/drivers/wdm/audio/backpln/portcls/CMakeLists.txt +++ b/drivers/wdm/audio/backpln/portcls/CMakeLists.txt @@ -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() diff --git a/sdk/cmake/msvc.cmake b/sdk/cmake/msvc.cmake index 2d482227730..ede1597a454 100644 --- a/sdk/cmake/msvc.cmake +++ b/sdk/cmake/msvc.cmake @@ -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("$<$:-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($<$: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") diff --git a/sdk/lib/3rdparty/stlport/CMakeLists.txt b/sdk/lib/3rdparty/stlport/CMakeLists.txt index b2f245bb62f..2fb3f5643a5 100644 --- a/sdk/lib/3rdparty/stlport/CMakeLists.txt +++ b/sdk/lib/3rdparty/stlport/CMakeLists.txt @@ -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) diff --git a/sdk/lib/crt/stdlib/stdlib.cmake b/sdk/lib/crt/stdlib/stdlib.cmake index aaf745c4519..3ab02840e34 100644 --- a/sdk/lib/crt/stdlib/stdlib.cmake +++ b/sdk/lib/crt/stdlib/stdlib.cmake @@ -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 diff --git a/subsystems/mvdm/asm16.cmake b/subsystems/mvdm/asm16.cmake index 3848aa1f129..a2df957c080 100644 --- a/subsystems/mvdm/asm16.cmake +++ b/subsystems/mvdm/asm16.cmake @@ -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") diff --git a/win32ss/printing/base/spoolsv/CMakeLists.txt b/win32ss/printing/base/spoolsv/CMakeLists.txt index 6602eba9fab..566fe63f107 100644 --- a/win32ss/printing/base/spoolsv/CMakeLists.txt +++ b/win32ss/printing/base/spoolsv/CMakeLists.txt @@ -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()