Refactor out some stuff to CMake tests
Refactor out some stuff to CMake tests