Fix some bugs in the cmake, now it can be find with find_package()