FindOpenSSL: Add component support
I had a problem a long time ago that OPENSSL_LIBRARIES
includes the OPENSSL_SSL_LIBRARY
but OPENSSL_FOUND
does not check for it. On my Windows CI machine this condition is hit and cmake failures occur.
I made merge request !371 (merged) which was in 3.8.0. However this was reversed in 3.8.2 due to #16882 (closed), which I didn't notice until I tried to remove our local hacky fix this week.
Maybe this Pull Req would be a more suitable fix for the long term. The behaviour is intended to be:
-
OPENSSL_FOUND
set ifOPENSSL_CRYPTO_LIBRARY
is found (old behaviour). This behaviour is now documented. -
COMPONENTS
can be sent infind_package
. These areSSL
andCrypto
to match the existing targets. If you sendCOMPONENTS
thenOPENSSL_FOUND
will only beTRUE
if all are available. This is new behaviour. -
OpenSSL::SSL
and/orOpenSSL::Crypto
imported targets will only be created ifOPENSSL_FOUND
isTRUE
(existing behavior maintained). -
OPENSSL_VERSION
is sent tofind_package_handle_standard_args
without checking it exists as the function does that for us I believe. This is a change in behaviour, but should be backwards compatible.
Topic-rename: FindOpenSSL-components
Edited by Craig Scott