Use build dir name as target dirname for binaries. Don't force debug mode for mingw. Fix compilation error on mingw gcc 4.7