514
|
1 # http://sourceforge.net/apps/trac/mingw-w64/wiki/GeneralUsageInstructions
|
|
2
|
|
3 # the name of the target operating system
|
|
4 SET(CMAKE_SYSTEM_NAME Windows)
|
|
5
|
|
6 # Detect the prefix of the mingw-w64 compiler
|
|
7 execute_process(
|
|
8 COMMAND uname -p
|
|
9 OUTPUT_VARIABLE MINGW64_ARCHITECTURE
|
|
10 OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
11 )
|
|
12
|
|
13 if (${MINGW64_ARCHITECTURE} STREQUAL "x86_64")
|
|
14 set(MINGW64_PREFIX "x86_64")
|
|
15 else()
|
|
16 set(MINGW64_PREFIX "i686")
|
|
17 endif()
|
|
18
|
|
19 # which compilers to use for C and C++
|
|
20 SET(CMAKE_C_COMPILER ${MINGW64_PREFIX}-w64-mingw32-gcc)
|
|
21 SET(CMAKE_CXX_COMPILER ${MINGW64_PREFIX}-w64-mingw32-g++)
|
|
22 SET(CMAKE_RC_COMPILER ${MINGW64_PREFIX}-w64-mingw32-windres)
|
|
23
|
|
24 # here is the target environment located
|
|
25 SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
|
|
26
|
|
27 # adjust the default behaviour of the FIND_XXX() commands:
|
|
28 # search headers and libraries in the target environment, search
|
|
29 # programs in the host environment
|
|
30 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
31 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
32 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
33
|
|
34 SET(CMAKE_RC_COMPILE_OBJECT "${CMAKE_RC_COMPILER} -O coff -I${CMAKE_CURRENT_SOURCE_DIR} <SOURCE> <OBJECT>")
|