CMake build system

Hi,
Here's an attempt to port to cmake build system, for review and discussion.
xan.