set(CMAKE_SYSTEM_NAME Windows)

if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
    set(_CROSS_PREFIX "x86_64")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
    set(_CROSS_PREFIX "i686")
endif()

set(CMAKE_C_COMPILER ${_CROSS_PREFIX}-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER ${_CROSS_PREFIX}-w64-mingw32-g++)
set(CMAKE_RC_COMPILER ${_CROSS_PREFIX}-w64-mingw32-windres)
set(CMAKE_RANLIB ${_CROSS_PREFIX}-w64-mingw32-ranlib)

set(CMAKE_FIND_ROOT_PATH /usr/${_CROSS_PREFIX}-w64-mingw32 ${CMAKE_PREFIX_PATH})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
