d1699c38d4a7afa838eb995068d47106ac8ea827
[reactos.git] / toolchain-msvc.cmake
1
2 if(NOT ARCH)
3 set(ARCH i386)
4 endif()
5
6 # Default to Debug for the build type
7 if(NOT DEFINED CMAKE_BUILD_TYPE)
8 set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
9 "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
10 endif()
11
12 # the name of the target operating system
13 set(CMAKE_SYSTEM_NAME Windows)
14 set(CMAKE_SYSTEM_PROCESSOR i686)
15
16 # which compilers to use for C and C++
17 # clang-cl gets detected as "Clang" instead of "MSVC" so we force it here
18 if(USE_CLANG_CL)
19 include(CMakeForceCompiler)
20 CMAKE_FORCE_C_COMPILER(clang-cl MSVC)
21 set(CMAKE_C_COMPILER_VERSION "16.00.40219.01")
22 if(ARCH STREQUAL "i386")
23 set(MSVC_C_ARCHITECTURE_ID "X86")
24 endif()
25 include(${CMAKE_ROOT}/Modules/CMakeClDeps.cmake)
26 else()
27 set(CMAKE_C_COMPILER cl)
28 endif()
29
30 if(ARCH STREQUAL "arm")
31 include(CMakeForceCompiler)
32 CMAKE_FORCE_CXX_COMPILER(cl MSVC)
33 else()
34 if(USE_CLANG_CL)
35 include(CMakeForceCompiler)
36 CMAKE_FORCE_CXX_COMPILER(clang-cl MSVC)
37 else()
38 set(CMAKE_CXX_COMPILER cl)
39 endif()
40 endif()
41
42 set(CMAKE_MC_COMPILER mc)
43 set(CMAKE_RC_COMPILER rc)
44 if(ARCH STREQUAL "amd64")
45 set(CMAKE_ASM_COMPILER ml64)
46 elseif(ARCH STREQUAL "arm")
47 set(CMAKE_ASM_COMPILER armasm)
48 elseif(ARCH STREQUAL "arm64")
49 set(CMAKE_ASM_COMPILER armasm64)
50 else()
51 set(CMAKE_ASM_COMPILER ml)
52 endif()
53 set(CMAKE_ASM_COMPILER_ID "VISUAL")
54
55 set(CMAKE_C_STANDARD_LIBRARIES "" CACHE INTERNAL "")
56
57 if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
58 add_definitions(-D__i386__)
59 endif()
60
61 set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_LIST_DIR}/overrides-msvc.cmake")