Commit 13278913 authored by gnaggnoyil's avatar gnaggnoyil
Browse files

FindOpenSSL: add target OpenSSL::applink to support OpenSSL's applink feature

Fixes: #20701
parent 327e79c3
Pipeline #172823 passed with stages
in 5 minutes and 5 seconds
......@@ -22,6 +22,13 @@ This module defines the following :prop_tgt:`IMPORTED` targets:
The OpenSSL ``ssl`` library, if found.
``OpenSSL::Crypto``
The OpenSSL ``crypto`` library, if found.
``OpenSSL::applink``
The OpenSSL ``applink`` components 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 plaforms other than
MSVC.
Result Variables
^^^^^^^^^^^^^^^^
......@@ -45,6 +52,10 @@ This module will set the following variables in your project:
All OpenSSL libraries and their dependencies.
``OPENSSL_VERSION``
This is set to ``$major.$minor.$revision$patch`` (e.g. ``0.9.8s``).
``OPENSSL_APPLINK_SOURCES``
The sources in the target ``OpenSSL::applink`` that 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.
Hints
^^^^^
......@@ -524,6 +535,28 @@ if(OPENSSL_FOUND)
endif()
_OpenSSL_target_add_dependencies(OpenSSL::SSL)
endif()
if("${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_FIX}" VERSION_GREATER_EQUAL "0.9.8")
if(WIN32 AND NOT CYGWIN AND MSVC)
if(EXISTS "${OPENSSL_INCLUDE_DIR}")
set(_OPENSSL_applink_paths PATHS ${OPENSSL_INCLUDE_DIR})
endif()
find_file(OPENSSL_APPLINK_SOURCES
NAMES
openssl/applink.c
${_OPENSSL_applink_paths}
NO_DEFAULT_PATH)
if(NOT "${OPENSSL_APPLINK_SOURCES}" MATCHES "-NOTFOUND$")
set(_OPENSSL_applink_interface_srcs ${OPENSSL_APPLINK_SOURCES})
endif()
endif()
if(NOT TARGET OpenSSL::applink)
add_library(OpenSSL::applink INTERFACE IMPORTED)
set_property(TARGET OpenSSL::applink APPEND
PROPERTY INTERFACE_SOURCES
${_OPENSSL_applink_interface_srcs})
endif()
endif()
endif()
# Restore the original find library ordering
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment