Fix CMake warnings on OS X

fixes #7417
Initialize Winsock API using INITIALIZE_ONCE

fixes #7413
Implement platform-independent wrapper for poll()