Fix CMake build system

* Bring source list up to date
* Handle dependencies properly