mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-20 14:10:27 -06:00
FindOpenSSL: Add OpenSSL_VERSION
This deprecates the OPENSSL_VERSION result variable. Issue: #27088
This commit is contained in:
@@ -31,6 +31,9 @@ Find Modules
|
|||||||
* The :module:`FindLTTngUST` module now provides a ``LTTngUST_VERSION`` result
|
* The :module:`FindLTTngUST` module now provides a ``LTTngUST_VERSION`` result
|
||||||
variable. The ``LTTNGUST_VERSION_STRING`` result variable is deprecated.
|
variable. The ``LTTNGUST_VERSION_STRING`` result variable is deprecated.
|
||||||
|
|
||||||
|
* The :module:`FindOpenSSL` module now provides an ``OpenSSL_VERSION`` result
|
||||||
|
variable. The ``OPENSSL_VERSION`` result variable is deprecated.
|
||||||
|
|
||||||
* The :module:`FindPNG` module now provides a ``PNG_VERSION`` result
|
* The :module:`FindPNG` module now provides a ``PNG_VERSION`` result
|
||||||
variable. The ``PNG_VERSION_STRING`` result variable is deprecated.
|
variable. The ``PNG_VERSION_STRING`` result variable is deprecated.
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,11 @@
|
|||||||
FindOpenSSL
|
FindOpenSSL
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Finds the installed OpenSSL encryption library and determines its version.
|
Finds the installed OpenSSL encryption library and determines its version:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
|
find_package(OpenSSL [<version>] [COMPONENTS <components>...] [...])
|
||||||
|
|
||||||
.. versionadded:: 3.20
|
.. versionadded:: 3.20
|
||||||
Support for specifying version range when calling the :command:`find_package`
|
Support for specifying version range when calling the :command:`find_package`
|
||||||
@@ -95,23 +99,34 @@ Result Variables
|
|||||||
This module defines the following variables:
|
This module defines the following variables:
|
||||||
|
|
||||||
``OpenSSL_FOUND``
|
``OpenSSL_FOUND``
|
||||||
Boolean indicating whether the OpenSSL library has been found. For backward
|
Boolean indicating whether (the requested version of) OpenSSL library has
|
||||||
compatibility, the ``OPENSSL_FOUND`` variable is also set to the same value.
|
been found. For backward compatibility, the ``OPENSSL_FOUND`` variableđ
|
||||||
|
is also set to the same value.
|
||||||
|
|
||||||
|
``OpenSSL_VERSION``
|
||||||
|
.. versionadded:: 4.2
|
||||||
|
|
||||||
|
The OpenSSL version found. This is set to
|
||||||
|
``<major>.<minor>.<revision><patch>`` (e.g., ``0.9.8s``).
|
||||||
|
|
||||||
``OPENSSL_INCLUDE_DIR``
|
``OPENSSL_INCLUDE_DIR``
|
||||||
The OpenSSL include directory.
|
The OpenSSL include directory.
|
||||||
|
|
||||||
``OPENSSL_CRYPTO_LIBRARY``
|
``OPENSSL_CRYPTO_LIBRARY``
|
||||||
The OpenSSL ``crypto`` library.
|
The OpenSSL ``crypto`` library.
|
||||||
|
|
||||||
``OPENSSL_CRYPTO_LIBRARIES``
|
``OPENSSL_CRYPTO_LIBRARIES``
|
||||||
The OpenSSL ``crypto`` library and its dependencies.
|
The OpenSSL ``crypto`` library and its dependencies.
|
||||||
|
|
||||||
``OPENSSL_SSL_LIBRARY``
|
``OPENSSL_SSL_LIBRARY``
|
||||||
The OpenSSL ``ssl`` library.
|
The OpenSSL ``ssl`` library.
|
||||||
|
|
||||||
``OPENSSL_SSL_LIBRARIES``
|
``OPENSSL_SSL_LIBRARIES``
|
||||||
The OpenSSL ``ssl`` library and its dependencies.
|
The OpenSSL ``ssl`` library and its dependencies.
|
||||||
|
|
||||||
``OPENSSL_LIBRARIES``
|
``OPENSSL_LIBRARIES``
|
||||||
All OpenSSL libraries and their dependencies.
|
All OpenSSL libraries and their dependencies.
|
||||||
``OPENSSL_VERSION``
|
|
||||||
The OpenSSL version found. This is set to
|
|
||||||
``<major>.<minor>.<revision><patch>`` (e.g. ``0.9.8s``).
|
|
||||||
``OPENSSL_APPLINK_SOURCE``
|
``OPENSSL_APPLINK_SOURCE``
|
||||||
The sources in the target ``OpenSSL::applink`` mentioned above. This variable
|
The sources in the target ``OpenSSL::applink`` mentioned above. This variable
|
||||||
is only defined if found OpenSSL version is at least 0.9.8 and the platform is
|
is only defined if found OpenSSL version is at least 0.9.8 and the platform is
|
||||||
@@ -142,6 +157,17 @@ This module accepts the following variables to control the search behavior:
|
|||||||
``PKG_CONFIG_PATH`` environment variable to specify alternate locations, which
|
``PKG_CONFIG_PATH`` environment variable to specify alternate locations, which
|
||||||
is useful on systems with multiple library installations.
|
is useful on systems with multiple library installations.
|
||||||
|
|
||||||
|
Deprecated Variables
|
||||||
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
The following variables are provided for backward compatibility:
|
||||||
|
|
||||||
|
``OPENSSL_VERSION``
|
||||||
|
.. deprecated:: 4.2
|
||||||
|
Superseded by the ``OpenSSL_VERSION``.
|
||||||
|
|
||||||
|
The version of OpenSSL found.
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
@@ -661,7 +687,8 @@ if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
|
|||||||
string(ASCII "${OPENSSL_VERSION_PATCH_ASCII}" OPENSSL_VERSION_PATCH_STRING)
|
string(ASCII "${OPENSSL_VERSION_PATCH_ASCII}" OPENSSL_VERSION_PATCH_STRING)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}")
|
set(OpenSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}")
|
||||||
|
set(OPENSSL_VERSION "${OpenSSL_VERSION}")
|
||||||
else ()
|
else ()
|
||||||
# Since OpenSSL 3.0.0, the new version format is MAJOR.MINOR.PATCH and
|
# Since OpenSSL 3.0.0, the new version format is MAJOR.MINOR.PATCH and
|
||||||
# a new OPENSSL_VERSION_STR macro contains exactly that
|
# a new OPENSSL_VERSION_STR macro contains exactly that
|
||||||
@@ -670,10 +697,11 @@ if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
|
|||||||
string(REGEX REPLACE "^.*OPENSSL_VERSION_STR[\t ]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*$"
|
string(REGEX REPLACE "^.*OPENSSL_VERSION_STR[\t ]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*$"
|
||||||
"\\1" OPENSSL_VERSION_STR "${OPENSSL_VERSION_STR}")
|
"\\1" OPENSSL_VERSION_STR "${OPENSSL_VERSION_STR}")
|
||||||
|
|
||||||
set(OPENSSL_VERSION "${OPENSSL_VERSION_STR}")
|
set(OpenSSL_VERSION "${OPENSSL_VERSION_STR}")
|
||||||
|
set(OPENSSL_VERSION "${OpenSSL_VERSION}")
|
||||||
|
|
||||||
# Setting OPENSSL_VERSION_MAJOR OPENSSL_VERSION_MINOR and OPENSSL_VERSION_FIX
|
# Setting OPENSSL_VERSION_MAJOR OPENSSL_VERSION_MINOR and OPENSSL_VERSION_FIX
|
||||||
string(REGEX MATCHALL "([0-9])+" OPENSSL_VERSION_NUMBER "${OPENSSL_VERSION}")
|
string(REGEX MATCHALL "([0-9])+" OPENSSL_VERSION_NUMBER "${OpenSSL_VERSION}")
|
||||||
list(POP_FRONT OPENSSL_VERSION_NUMBER
|
list(POP_FRONT OPENSSL_VERSION_NUMBER
|
||||||
OPENSSL_VERSION_MAJOR
|
OPENSSL_VERSION_MAJOR
|
||||||
OPENSSL_VERSION_MINOR
|
OPENSSL_VERSION_MINOR
|
||||||
@@ -718,7 +746,7 @@ find_package_handle_standard_args(OpenSSL
|
|||||||
OPENSSL_CRYPTO_LIBRARY
|
OPENSSL_CRYPTO_LIBRARY
|
||||||
OPENSSL_INCLUDE_DIR
|
OPENSSL_INCLUDE_DIR
|
||||||
VERSION_VAR
|
VERSION_VAR
|
||||||
OPENSSL_VERSION
|
OpenSSL_VERSION
|
||||||
HANDLE_VERSION_RANGE
|
HANDLE_VERSION_RANGE
|
||||||
HANDLE_COMPONENTS
|
HANDLE_COMPONENTS
|
||||||
FAIL_MESSAGE
|
FAIL_MESSAGE
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ foreach(
|
|||||||
HDF5
|
HDF5
|
||||||
Jasper JPEG
|
Jasper JPEG
|
||||||
LibArchive LibLZMA LIBLZMA LibXml2 LibXslt LTTngUST
|
LibArchive LibLZMA LIBLZMA LibXml2 LibXslt LTTngUST
|
||||||
OPENSCENEGRAPH
|
OPENSCENEGRAPH OpenSSL OPENSSL
|
||||||
PNG PostgreSQL Protobuf
|
PNG PostgreSQL Protobuf
|
||||||
Ruby RUBY
|
Ruby RUBY
|
||||||
SDL SWIG
|
SDL SWIG
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
find_package (OpenSSL REQUIRED COMPONENTS Crypto)
|
find_package (OpenSSL REQUIRED COMPONENTS Crypto)
|
||||||
# Store version without a possibly trailing letter.
|
# Store version without a possibly trailing letter.
|
||||||
string (REGEX MATCH "^([0-9.]+)" version "${OPENSSL_VERSION}")
|
string (REGEX MATCH "^([0-9.]+)" version "${OpenSSL_VERSION}")
|
||||||
|
|
||||||
# clean-up OpenSSL variables
|
# clean-up OpenSSL variables
|
||||||
unset (OPENSSL_INCLUDE_DIR)
|
unset (OPENSSL_INCLUDE_DIR)
|
||||||
unset (OPENSSL_CRYPTO_LIBRARY)
|
unset (OPENSSL_CRYPTO_LIBRARY)
|
||||||
unset (OPENSSL_CRYPTO_LIBRARIES)
|
unset (OPENSSL_CRYPTO_LIBRARIES)
|
||||||
unset (OPENSSL_LIBRARIES)
|
unset (OPENSSL_LIBRARIES)
|
||||||
unset (OPENSSL_VERSION)
|
unset (OpenSSL_VERSION)
|
||||||
unset (OpenSSL_FOUND)
|
unset (OpenSSL_FOUND)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
find_package (OpenSSL REQUIRED COMPONENTS Crypto)
|
find_package (OpenSSL REQUIRED COMPONENTS Crypto)
|
||||||
# Store version without a possibly trailing letter.
|
# Store version without a possibly trailing letter.
|
||||||
string (REGEX MATCH "^([0-9.]+)" version "${OPENSSL_VERSION}")
|
string (REGEX MATCH "^([0-9.]+)" version "${OpenSSL_VERSION}")
|
||||||
|
|
||||||
# clean-up OpenSSL variables
|
# clean-up OpenSSL variables
|
||||||
unset (OPENSSL_INCLUDE_DIR)
|
unset (OPENSSL_INCLUDE_DIR)
|
||||||
unset (OPENSSL_CRYPTO_LIBRARY)
|
unset (OPENSSL_CRYPTO_LIBRARY)
|
||||||
unset (OPENSSL_CRYPTO_LIBRARIES)
|
unset (OPENSSL_CRYPTO_LIBRARIES)
|
||||||
unset (OPENSSL_LIBRARIES)
|
unset (OPENSSL_LIBRARIES)
|
||||||
unset (OPENSSL_VERSION)
|
unset (OpenSSL_VERSION)
|
||||||
unset (OpenSSL_FOUND)
|
unset (OpenSSL_FOUND)
|
||||||
|
|
||||||
## Specify a range including current OpenSSL version
|
## Specify a range including current OpenSSL version
|
||||||
@@ -24,7 +24,7 @@ unset (OPENSSL_INCLUDE_DIR)
|
|||||||
unset (OPENSSL_CRYPTO_LIBRARY)
|
unset (OPENSSL_CRYPTO_LIBRARY)
|
||||||
unset (OPENSSL_CRYPTO_LIBRARIES)
|
unset (OPENSSL_CRYPTO_LIBRARIES)
|
||||||
unset (OPENSSL_LIBRARIES)
|
unset (OPENSSL_LIBRARIES)
|
||||||
unset (OPENSSL_VERSION)
|
unset (OpenSSL_VERSION)
|
||||||
unset (OpenSSL_FOUND)
|
unset (OpenSSL_FOUND)
|
||||||
|
|
||||||
## Specify a range excluding current OpenSSL version
|
## Specify a range excluding current OpenSSL version
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
find_package (OpenSSL REQUIRED COMPONENTS Crypto)
|
find_package (OpenSSL REQUIRED COMPONENTS Crypto)
|
||||||
# Store version without a possibly trailing letter.
|
# Store version without a possibly trailing letter.
|
||||||
string (REGEX MATCH "^([0-9.]+)" version "${OPENSSL_VERSION}")
|
string (REGEX MATCH "^([0-9.]+)" version "${OpenSSL_VERSION}")
|
||||||
|
|
||||||
# clean-up OpenSSL variables
|
# clean-up OpenSSL variables
|
||||||
unset (OPENSSL_INCLUDE_DIR)
|
unset (OPENSSL_INCLUDE_DIR)
|
||||||
unset (OPENSSL_CRYPTO_LIBRARY)
|
unset (OPENSSL_CRYPTO_LIBRARY)
|
||||||
unset (OPENSSL_CRYPTO_LIBRARIES)
|
unset (OPENSSL_CRYPTO_LIBRARIES)
|
||||||
unset (OPENSSL_LIBRARIES)
|
unset (OPENSSL_LIBRARIES)
|
||||||
unset (OPENSSL_VERSION)
|
unset (OpenSSL_VERSION)
|
||||||
unset (OpenSSL_FOUND)
|
unset (OpenSSL_FOUND)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user