a53a18591dfc7ee0465a735ba43573e850fd6441
[reactos.git] / toolchain-mingw32.cmake
1
2 set(ARCH i386)
3
4 # Choose the right MinGW prefix
5 if (CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
6 set(MINGW_PREFIX "" CACHE STRING "MinGW Prefix")
7 else()
8 set(MINGW_PREFIX "mingw32-" CACHE STRING "MinGW Prefix")
9 endif()
10
11 # the name of the target operating system
12 SET(CMAKE_SYSTEM_NAME Windows)
13 SET(CMAKE_SYSTEM_PROCESSOR i686)
14
15 # which compilers to use for C and C++
16 SET(CMAKE_C_COMPILER ${MINGW_PREFIX}gcc)
17 SET(CMAKE_CXX_COMPILER ${MINGW_PREFIX}g++)
18 SET(CMAKE_RC_COMPILER ${MINGW_PREFIX}windres)
19 SET(CMAKE_ASM_COMPILER ${MINGW_PREFIX}gcc)
20 SET(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -x assembler-with-cpp -o <OBJECT> <FLAGS> <DEFINES> -D__ASM__ -c <SOURCE>")
21
22 SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -i <SOURCE> <CMAKE_C_LINK_FLAGS> <DEFINES> -I${REACTOS_SOURCE_DIR}/include/psdk -I${REACTOS_BINARY_DIR}/include/psdk -I${REACTOS_SOURCE_DIR}/include/ -I${REACTOS_SOURCE_DIR}/include/reactos -I${REACTOS_BINARY_DIR}/include/reactos -I${REACTOS_SOURCE_DIR}/include/reactos/wine -I${REACTOS_SOURCE_DIR}/include/crt -I${REACTOS_SOURCE_DIR}/include/crt/mingw32 -O coff -o <OBJECT> ")
23
24 # Use stdcall fixups, and don't link with anything by default unless we say so
25 set(CMAKE_C_STANDARD_LIBRARIES -lgcc CACHE STRING "libgcc") # We should add the environment libgcc here
26 set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nodefaultlibs -nostdlib -Wl,--enable-auto-image-base -Wl,--enable-stdcall-fixup -Wl,--kill-at -Wl,-T,${REACTOS_SOURCE_DIR}/global.lds")
27
28 # adjust the default behaviour of the FIND_XXX() commands:
29 # search headers and libraries in the target environment, search
30 # programs in the host environment
31 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
32 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
33 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
34