Fix CMake build flags for MinGW