Cribbed from the PuTTY one. Use with something like cmake . -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-mingw.cmake