xref: /reactos/toolchain-msvc.cmake (revision d5b576b2)
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# which compilers to use for C and C++
17# clang-cl gets detected as "Clang" instead of "MSVC" so we force it here
18if(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)
26else()
27    set(CMAKE_C_COMPILER cl)
28endif()
29
30if(ARCH STREQUAL "arm")
31    include(CMakeForceCompiler)
32    CMAKE_FORCE_CXX_COMPILER(cl MSVC)
33else()
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()
40endif()
41
42set(CMAKE_MC_COMPILER mc)
43set(CMAKE_RC_COMPILER rc)
44if(ARCH STREQUAL "amd64")
45    set(CMAKE_ASM_COMPILER ml64)
46elseif(ARCH STREQUAL "arm")
47    set(CMAKE_ASM_COMPILER armasm)
48else()
49    set(CMAKE_ASM_COMPILER ml)
50endif()
51set(CMAKE_ASM_COMPILER_ID "VISUAL")
52
53set(CMAKE_C_STANDARD_LIBRARIES "" CACHE INTERNAL "")
54
55if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
56    add_definitions(-D__i386__)
57endif()
58