set(MINGW_TOOLCHAIN @MINGW_TOOLCHAIN@) set(MINGW_ROOT "/usr/${MINGW_TOOLCHAIN}") set(CMAKE_CROSSCOMPILING ON) set(CMAKE_SYSTEM_NAME Windows) string(REPLACE "-w64-mingw32" "" CMAKE_SYSTEM_PROCESSOR "${MINGW_TOOLCHAIN}") set(CMAKE_AR "${MINGW_TOOLCHAIN}-ar") set(CMAKE_C_COMPILER "${MINGW_TOOLCHAIN}-gcc") set(CMAKE_CXX_COMPILER "${MINGW_TOOLCHAIN}-g++") set(CMAKE_RC_COMPILER "${MINGW_TOOLCHAIN}-windres") set(CMAKE_MC_COMPILER "${MINGW_TOOLCHAIN}-windmc") set(CMAKE_OBJCOPY "${MINGW_TOOLCHAIN}-objcopy") set(CMAKE_OBJDUMP "${MINGW_TOOLCHAIN}-objdump") set(CMAKE_READELF "${MINGW_TOOLCHAIN}-readelf") set(CMAKE_RANLIB "${MINGW_TOOLCHAIN}-ranlib") set(CMAKE_FIND_ROOT_PATH "/usr/${MINGW_TOOLCHAIN}") set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_INSTALL_PREFIX "${MINGW_ROOT}" CACHE PATH "Installation prefix") find_program(MINGW_WINE wine) if(MINGW_WINE) set(CMAKE_CROSSCOMPILING_EMULATOR ${MINGW_WINE}) endif()