CMake: Make SONAME versioning function like Autotools on OSX

See the commit for details.

Change-Id: I30175c098bc9f39b2426160f08bcce3225d6a50a
Reviewed-on: http://review.couchbase.org/43158
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>