xref: /reactos/toolchain-msvc.cmake (revision c8d07514)
1
2if(NOT ARCH)
3    set(ARCH i386)
4endif()
5
6# Default to Debug for the build type
7if(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.")
10endif()
11
12# the name of the target operating system
13set(CMAKE_SYSTEM_NAME Windows)
14set(CMAKE_SYSTEM_PROCESSOR i686)
15
16# set the generator platform
17if (NOT DEFINED CMAKE_GENERATOR_PLATFORM)
18    if(ARCH STREQUAL "amd64")
19        set(CMAKE_GENERATOR_PLATFORM "x64")
20    elseif(ARCH STREQUAL "arm")
21        set(CMAKE_GENERATOR_PLATFORM "ARM")
22    elseif(ARCH STREQUAL "arm64")
23        set(CMAKE_GENERATOR_PLATFORM "ARM64")
24    else()
25        set(CMAKE_GENERATOR_PLATFORM "Win32")
26    endif()
27endif()
28
29if(USE_CLANG_CL)
30    set(CMAKE_C_COMPILER clang-cl)
31    set(CMAKE_CXX_COMPILER clang-cl)
32    # Clang now defaults to lld-link which we're not compatible with yet
33    set(CMAKE_LINKER link)
34    # Explicitly set target so CMake doesn't get confused
35    if (ARCH STREQUAL "amd64")
36        set(CMAKE_C_COMPILER_TARGET "x86_64-pc-windows-msvc")
37        set(CMAKE_CXX_COMPILER_TARGET "x86_64-pc-windows-msvc")
38    elseif(ARCH STREQUAL "arm")
39        set(CMAKE_C_COMPILER_TARGET "arm-pc-windows-msvc")
40        set(CMAKE_CXX_COMPILER_TARGET "arm-pc-windows-msvc")
41    elseif(ARCH STREQUAL "arm64")
42        set(CMAKE_C_COMPILER_TARGET "arm64-pc-windows-msvc")
43        set(CMAKE_CXX_COMPILER_TARGET "arm64-pc-windows-msvc")
44    else()
45        set(CMAKE_C_COMPILER_TARGET "i686-pc-windows-msvc")
46        set(CMAKE_CXX_COMPILER_TARGET "i686-pc-windows-msvc")
47    endif()
48else()
49    set(CMAKE_C_COMPILER cl)
50    set(CMAKE_CXX_COMPILER cl)
51endif()
52
53set(CMAKE_MC_COMPILER mc)
54set(CMAKE_RC_COMPILER rc)
55if(ARCH STREQUAL "amd64")
56    set(CMAKE_ASM_COMPILER ml64)
57elseif(ARCH STREQUAL "arm")
58    set(CMAKE_ASM_COMPILER armasm)
59elseif(ARCH STREQUAL "arm64")
60    set(CMAKE_ASM_COMPILER armasm64)
61else()
62    set(CMAKE_ASM_COMPILER ml)
63endif()
64
65
66set(CMAKE_C_STANDARD_LIBRARIES "" CACHE INTERNAL "")
67
68set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_LIST_DIR}/overrides-msvc.cmake")
69