Updated most build scripts to autofind files.

This is very primitively done at the moment. Only .h headers and .cpp source files are currently supported. This should be expaneded to use better globbing expressions in the cmake files. The only caveat is that if files are added/removed cmake needs to be re-run to regenerate the build files. I do not see this as a big problem, though.
Minor linux compile fixes after last upstream merge