cmake: fix clang build and few minor fixes