CMake build: Various fixes for Windows/MSVC compatibility.
CMake build: only hide symbols when building a shared object.