# From https://www.mingw-w64.org/build-systems/cmake/ set(CMAKE_SYSTEM_NAME Windows) set(CMAKE_SYSTEM_PROCESSOR x86_64) # Specify the cross-compiler. set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) # Specify the target environment. set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) # Search for programs in the build host directories. set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # Search for libraries and headers in the target directories. set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # CMake determines how to examine dependencies based on the *host* system, leading to # a "file unknown error" unless the target platform is explicitly specified. set(CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM "windows+pe")