Improve cmake config class, break it out into a separate file, add config caching functionality.