Improve cmakelists to increase the compatibility with gentoo portage system