major rework of build to CMake