Find the OpenSSL encryption library.
This module finds an installed OpenSSL library and determines its version.
New in version 3.19: When a version is requested, it can be specified as a simple value or as a
range. For a detailed description of version range usage and capabilities,
refer to the
New in version 3.18: Support for OpenSSL 3.0.
New in version 3.12.
This module supports two optional COMPONENTS:
components have associated imported targets, as described below.
New in version 3.4.
This module defines the following
ssllibrary, if found.
cryptolibrary, if found.
New in version 3.18.
applinkcomponents that might be need to be compiled into projects under MSVC. This target is available only if found OpenSSL version is not less than 0.9.8. By linking this target the above OpenSSL targets can be linked even if the project has different MSVC runtime configurations with the above OpenSSL targets. This target has no effect on platforms other than MSVC.
NOTE: Due to how
INTERFACE_SOURCES are consumed by the consuming target,
unless you certainly know what you are doing, it is always preferred to link
OpenSSL::applink target as
PRIVATE and to make sure that this target is
linked at most once for the whole dependency graph of any library or
target_link_libraries(myTarget PRIVATE OpenSSL::applink)
Otherwise you would probably encounter unexpected random problems when building and linking, as both the ISO C and the ISO C++ standard claims almost nothing about what a link process should be.
This module will set the following variables in your project:
System has the OpenSSL library. If no components are requested it only requires the crypto library.
The OpenSSL include directory.
The OpenSSL crypto library.
The OpenSSL crypto library and its dependencies.
The OpenSSL SSL library.
The OpenSSL SSL library and its dependencies.
All OpenSSL libraries and their dependencies.
This is set to
The sources in the target
OpenSSL::applinkthat is mentioned above. This variable shall always be undefined if found openssl version is less than 0.9.8 or if platform is not MSVC.
OPENSSL_ROOT_DIR to the root directory of an OpenSSL installation.
New in version 3.4: Set
TRUE to look for static libraries.
New in version 3.5: Set
TRUE to choose the MT version of the lib.