FindOpenSSL: Fix regression in dependency on threads

Since commit 1b7804edd0 (FindOpenSSL: use extra dependencies from
pkg-config as well, 2022-12-05, v3.26.0-rc1~227^2) we conditionally find
Threads but unconditionally depend on it.  Make the conditions
consistent.

Fixes: #24505
1 file changed