Fixed a number of cmake issues