Automate build with cmake
Fix build with clang