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