1 set(CMAKE_SYSTEM_NAME Windows)
2 set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
3 set(CMAKE_SYSTEM_PROCESSOR x86_64)
5 # We'll need to use posix threads in order to use
6 # C++11 features, such as std::thread.
7 set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc-posix)
8 set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++-posix)
9 set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
11 set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX} /usr/lib/gcc/${TOOLCHAIN_PREFIX}/7.3-posix)
12 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
13 # TODO: consider switching this to "ONLY". The issue with
14 # that is that all our libs should then be under
15 # CMAKE_FIND_ROOT_PATH and CMAKE_PREFIX_PATH would be ignored.
16 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
17 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
19 # Some functions (e.g. localtime_r) will not be available unless we set
21 add_definitions(-D_POSIX=1)
22 add_definitions(-D_POSIX_C_SOURCE=1)
23 add_definitions(-D_POSIX_=1)
24 add_definitions(-D_POSIX_THREADS=1)