Improved build configuration Ⅱ

@berngp 
I merge your code to this PR