1 # Usage:
2 # cmake -DCMAKE_TOOLCHAIN_FILE=path/to/i686-w64-mingw32.cmake ..
4 set(CMAKE_SYSTEM_NAME Windows)
5 set(TOOLCHAIN_PREFIX i686-w64-mingw32)
7 # cross compilers to use for C, C++ and Fortran
8 set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
9 set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
10 set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
11 set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
13 # target environment on the build host system
14 set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}/sys-root/mingw)
16 # modify default behavior of FIND_XXX() commands
17 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
18 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
19 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
20 set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)