Replaced Makefile with CMakeLists.txt as well as support for compiling on MacOSX.