514
|
1 # http://sourceforge.net/apps/trac/mingw-w64/wiki/GeneralUsageInstructions
|
|
2
|
|
3 # the name of the target operating system
|
571
|
4 set(CMAKE_SYSTEM_NAME Windows)
|
514
|
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++
|
571
|
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)
|
514
|
23
|
|
24 # here is the target environment located
|
571
|
25 set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
|
514
|
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)
|