Doing some tweaks for get it to at least compile in OSX

These changes are formalized in cmake-osx branch