Suggestion: Move some of the compile.sh functionality to cmake.

This is just a suggestion... I think it makes it a bit nicer to work with cmake directly for those familiar with it instead of using compile.sh (tho that will still work exactly the same for those that want to use it).  It also makes it a bit nicer to work with some external tools like Qt Creator, maybe some other IDEs also support cmake directly.