CMake: Adjust for visibility settings

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