Fix a compile bug, add cmake scripts