cmake: run configure checks after finding OpenSSL
cmake: fix logic for type checks
openssl: support non-default include directories

Also use the right library variable.
msvc: attempts at making msvc happy

Incomplete.