[CMAKE]
[reactos.git] / reactos / toolchain-gcc.cmake
1
2 if(NOT ARCH)
3 set(ARCH i386)
4 endif()
5
6 # Choose the right MinGW prefix
7 if(ARCH MATCHES i386)
8
9 if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
10 set(MINGW_PREFIX "" CACHE STRING "MinGW Prefix")
11 else()
12 set(MINGW_PREFIX "mingw32-" CACHE STRING "MinGW Prefix")
13 endif(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
14
15 elseif(ARCH MATCHES amd64)
16 set(MINGW_PREFIX "x86_64-w64-mingw32-" CACHE STRING "MinGW Prefix")
17 elseif(ARCH MATCHES arm)
18 set(MINGW_PREFIX "arm-mingw32ce-" CACHE STRING "MinGW Prefix")
19 endif()
20
21 if(ENABLE_CCACHE)
22 set(CCACHE "ccache" CACHE STRING "ccache")
23 else()
24 set(CCACHE "" CACHE STRING "ccache")
25 endif()
26
27 # The name of the target operating system
28 set(CMAKE_SYSTEM_NAME Windows)
29 set(CMAKE_SYSTEM_PROCESSOR i686)
30
31 # Which compilers to use for C and C++
32 set(CMAKE_C_COMPILER ${CCACHE} ${MINGW_PREFIX}gcc)
33 set(CMAKE_CXX_COMPILER ${CCACHE} ${MINGW_PREFIX}g++)
34 set(CMAKE_RC_COMPILER ${MINGW_PREFIX}windres)
35 set(CMAKE_ASM_COMPILER ${MINGW_PREFIX}gcc)
36
37 if(NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
38 set(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> crs <TARGET> <LINK_FLAGS> <OBJECTS>")
39 set(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
40 set(CMAKE_ASM_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
41 endif()
42
43 # Don't link with anything by default unless we say so
44 set(CMAKE_C_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C Libraries")
45
46 #MARK_AS_ADVANCED(CLEAR CMAKE_CXX_STANDARD_LIBRARIES)
47 set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "Standard C++ Libraries")
48
49 set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nodefaultlibs -nostdlib -Wl,--enable-auto-image-base -Wl,--disable-auto-import")