Update/refactor CMake (can now build static library on OS X)