# CMake toolchain for cross-compiling to Windows x64 with MinGW-w64. # # Works with the GCC-based mingw-w64 package and with the LLVM-MinGW # toolchain (Dockerfile.mingw). Override the compiler paths for your install. # # Usage: # cmake -B build-mingw -S . -G Ninja \ # -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/mingw-w64.cmake \ # -DCMAKE_BUILD_TYPE=Debug set(CMAKE_SYSTEM_NAME Windows) set(CMAKE_SYSTEM_PROCESSOR x86_64) if(NOT DEFINED VOID_MINGW_PREFIX) set(VOID_MINGW_PREFIX x86_64-w64-mingw32) endif() find_program(VOID_MINGW_CXX NAMES "${VOID_MINGW_PREFIX}-clang++" "${VOID_MINGW_PREFIX}-g++" REQUIRED) find_program(VOID_MINGW_C NAMES "${VOID_MINGW_PREFIX}-clang" "${VOID_MINGW_PREFIX}-gcc" REQUIRED) find_program(VOID_MINGW_RC NAMES "${VOID_MINGW_PREFIX}-windres") set(CMAKE_CXX_COMPILER "${VOID_MINGW_CXX}") set(CMAKE_C_COMPILER "${VOID_MINGW_C}") if(VOID_MINGW_RC) set(CMAKE_RC_COMPILER "${VOID_MINGW_RC}") endif() set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)