Fix cmake build and warnings