qmake: cache() for Qt4 and ready to use compile test. unified with Qt5

Now we can cache the BUILD_DIR exactly in $$BUILD_DIR, with emulated
cache() for Qt4, and built-in cache() for Qt5. The code is a little
complex for Qt4
TODO:
1. 1cahce(): erase the existing lines contain the value