set(CMAKE_SYSTEM_NAME Windows)

if ("${CMAKE_HOST_SYSTEM}" MATCHES "Darwin")
    set(CMAKE_CXX_COMPILER /usr/local/bin/x86_64-w64-mingw32-g++)
    set(CMAKE_C_COMPILER /usr/local/bin/x86_64-w64-mingw32-gcc)
else ()
    set(CMAKE_CXX_COMPILER /usr/bin/x86_64-w64-mingw32-g++)
    set(CMAKE_C_COMPILER /usr/bin/x86_64-w64-mingw32-gcc)
endif ()

set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

if (MINGW)
    add_definitions(-D__STDC_FORMAT_MACROS)
    add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
endif ()