cmake: eoln and white-space fixes, slight refactor