Moving to cmake build scripts

Much less bloat now, building is indeed simpler, and the scripts are pretty clear.

I have tested this change on a few machines using different configurations, and it seems to be detecting libs very well. However, before I merge these changes in, I would be grateful if any third-party could confirm whether this works as expected.