Fix link order for GCC MinGW build

Holy crap, the order of the libs in the target_link_libraries() directive matters for GCC in MinGW.