Cmake fixes for #231 and #232