refactor CMakeLists.txt
fix build error with llvm-2.9
fix compiler warnings at posix.socket package