[IMM32] Renaming around ImmSystemHandler (#4602)
[reactos.git] / toolchain-msvc.cmake
1
2 # pass variables necessary for the toolchain (needed for try_compile)
3 set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES ARCH USE_CLANG_CL)
4
5 # the name of the target operating system
6 set(CMAKE_SYSTEM_NAME Windows)
7 set(CMAKE_SYSTEM_PROCESSOR i686)
8
9 # set the generator platform
10 if (NOT DEFINED CMAKE_GENERATOR_PLATFORM)
11 if(ARCH STREQUAL "amd64")
12 set(CMAKE_GENERATOR_PLATFORM "x64")
13 elseif(ARCH STREQUAL "arm")
14 set(CMAKE_GENERATOR_PLATFORM "ARM")
15 elseif(ARCH STREQUAL "arm64")
16 set(CMAKE_GENERATOR_PLATFORM "ARM64")
17 else()
18 set(CMAKE_GENERATOR_PLATFORM "Win32")
19 endif()
20 endif()
21
22 if(USE_CLANG_CL)
23 set(CMAKE_C_COMPILER clang-cl)
24 set(CMAKE_CXX_COMPILER clang-cl)
25 # Clang now defaults to lld-link which we're not compatible with yet
26 set(CMAKE_LINKER link)
27 # llvm-lib with link.exe can't generate proper delayed imports
28 set(CMAKE_AR lib)
29 set(CMAKE_C_COMPILER_AR lib)
30 set(CMAKE_CXX_COMPILER_AR lib)
31 # Explicitly set target so CMake doesn't get confused
32 if (ARCH STREQUAL "amd64")
33 set(CMAKE_C_COMPILER_TARGET "x86_64-pc-windows-msvc")
34 set(CMAKE_CXX_COMPILER_TARGET "x86_64-pc-windows-msvc")
35 elseif(ARCH STREQUAL "arm")
36 set(CMAKE_C_COMPILER_TARGET "arm-pc-windows-msvc")
37 set(CMAKE_CXX_COMPILER_TARGET "arm-pc-windows-msvc")
38 elseif(ARCH STREQUAL "arm64")
39 set(CMAKE_C_COMPILER_TARGET "arm64-pc-windows-msvc")
40 set(CMAKE_CXX_COMPILER_TARGET "arm64-pc-windows-msvc")
41 else()
42 set(CMAKE_C_COMPILER_TARGET "i686-pc-windows-msvc")
43 set(CMAKE_CXX_COMPILER_TARGET "i686-pc-windows-msvc")
44 endif()
45
46 # Avoid wrapping RC compiler with cmcldeps utility for clang-cl.
47 # Otherwise it breaks cross-compilation (32bit ReactOS cannot be compiled by 64bit LLVM),
48 # target architecture is not passed properly
49 set(CMAKE_NINJA_CMCLDEPS_RC OFF)
50 else()
51 set(CMAKE_C_COMPILER cl)
52 set(CMAKE_CXX_COMPILER cl)
53 endif()
54
55 set(CMAKE_MC_COMPILER mc)
56 set(CMAKE_RC_COMPILER rc)
57 if(ARCH STREQUAL "amd64")
58 set(CMAKE_ASM_MASM_COMPILER ml64)
59 set(CMAKE_ASM_MASM_FLAGS_INIT "/Cp")
60 elseif(ARCH STREQUAL "arm")
61 set(CMAKE_ASM_MASM_COMPILER armasm)
62 elseif(ARCH STREQUAL "arm64")
63 set(CMAKE_ASM_MASM_COMPILER armasm64)
64 else()
65 set(CMAKE_ASM_MASM_COMPILER ml)
66 set(CMAKE_ASM_MASM_FLAGS_INIT "/Cp")
67 endif()
68
69 set(CMAKE_C_STANDARD_LIBRARIES "" CACHE INTERNAL "")
70
71 set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_LIST_DIR}/overrides-msvc.cmake")