xref: /reactos/toolchain-clang.cmake (revision 62919904)
1
2if(NOT ARCH)
3    set(ARCH i386)
4endif()
5
6# Choose the right MinGW toolchain prefix
7if (NOT DEFINED MINGW_TOOLCHAIN_PREFIX)
8    if(ARCH STREQUAL "i386")
9
10        if(CMAKE_HOST_WIN32)
11            set(MINGW_TOOLCHAIN_PREFIX "" CACHE STRING "MinGW Toolchain Prefix")
12        else()
13            if(NOT $ENV{_ROSBE_VERSION} VERSION_LESS 2.1)
14                set(MINGW_TOOLCHAIN_PREFIX "i686-w64-mingw32-" CACHE STRING "MinGW-W64 Toolchain Prefix")
15            else()
16                set(MINGW_TOOLCHAIN_PREFIX "mingw32-" CACHE STRING "MinGW Toolchain Prefix")
17            endif()
18        endif()
19
20    elseif(ARCH STREQUAL "amd64")
21        set(MINGW_TOOLCHAIN_PREFIX "x86_64-w64-mingw32-" CACHE STRING "MinGW Toolchain Prefix")
22    elseif(ARCH STREQUAL "arm")
23        set(MINGW_TOOLCHAIN_PREFIX "arm-mingw32ce-" CACHE STRING "MinGW Toolchain Prefix")
24    endif()
25endif()
26
27if (NOT DEFINED MINGW_TOOLCHAIN_SUFFIX)
28    set(MINGW_TOOLCHAIN_SUFFIX "" CACHE STRING "MinGW Toolchain Suffix")
29endif()
30
31if(ENABLE_CCACHE)
32    set(CCACHE "ccache" CACHE STRING "ccache")
33else()
34    set(CCACHE "" CACHE STRING "ccache")
35endif()
36
37# The name of the target operating system
38set(CMAKE_SYSTEM_NAME Windows)
39set(CMAKE_SYSTEM_PROCESSOR i686)
40
41# Which tools to use
42set(CMAKE_C_COMPILER clang)
43set(CMAKE_CXX_COMPILER ${MINGW_TOOLCHAIN_PREFIX}g++${MINGW_TOOLCHAIN_SUFFIX})
44set(CMAKE_ASM_COMPILER ${MINGW_TOOLCHAIN_PREFIX}gcc${MINGW_TOOLCHAIN_SUFFIX})
45set(CMAKE_ASM_COMPILER_ID "GNU")
46set(CMAKE_MC_COMPILER ${MINGW_TOOLCHAIN_PREFIX}windmc)
47set(CMAKE_RC_COMPILER ${MINGW_TOOLCHAIN_PREFIX}windres)
48set(CMAKE_DLLTOOL ${MINGW_TOOLCHAIN_PREFIX}dlltool)
49
50if(CMAKE_HOST_WIN32)
51    set(CMAKE_AR ar)
52endif()
53
54set(CMAKE_C_CREATE_STATIC_LIBRARY "${CMAKE_AR} crT <TARGET> <LINK_FLAGS> <OBJECTS>")
55set(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
56set(CMAKE_ASM_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
57
58# Don't link with anything by default unless we say so
59set(CMAKE_C_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C Libraries")
60
61#MARK_AS_ADVANCED(CLEAR CMAKE_CXX_STANDARD_LIBRARIES)
62set(CMAKE_CXX_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C++ Libraries")
63
64set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nostdlib -Wl,--enable-auto-image-base,--disable-auto-import")
65set(CMAKE_MODULE_LINKER_FLAGS_INIT "-nostdlib -Wl,--enable-auto-image-base,--disable-auto-import")
66