Refactor some stuff out to CMake test
Refactor some stuff out to CMake test