Added cmake build system support.
Fixed merge conflicts.