Fix CMake files on centos 6

On Centos 6, the CMake files is broken. I have a fix and have tested on Centos 6.5.
Not only lmdb but also some other dependencies can't be installed in this way either. Maybe all the detailed steps are worth being documented.