Improved the cache cmake script.
Cleaned up the top-level cmake list.