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