Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CMake
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ben Stone
CMake
Commits
7b83ca81
Commit
7b83ca81
authored
4 years ago
by
gnaggnoyil
Browse files
Options
Downloads
Patches
Plain Diff
FindOpenSSL: add target OpenSSL::applink to support OpenSSL's applink feature
Fixes:
#20701
parent
327e79c3
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Modules/FindOpenSSL.cmake
+47
-0
47 additions, 0 deletions
Modules/FindOpenSSL.cmake
with
47 additions
and
0 deletions
Modules/FindOpenSSL.cmake
+
47
−
0
View file @
7b83ca81
...
...
@@ -22,6 +22,27 @@ 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.
NOTE: Due to how ``INTERFACE_SOURCES`` are consumed by the consuming target,
unless you certainly know what you are doing, it is always prefered 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
executable:
.. code-block:: cmake
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.
Result Variables
^^^^^^^^^^^^^^^^
...
...
@@ -45,6 +66,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_SOURCE``
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 +549,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
(
MSVC
)
if
(
EXISTS
"
${
OPENSSL_INCLUDE_DIR
}
"
)
set
(
_OPENSSL_applink_paths PATHS
${
OPENSSL_INCLUDE_DIR
}
)
endif
()
find_file
(
OPENSSL_APPLINK_SOURCE
NAMES
openssl/applink.c
${
_OPENSSL_applink_paths
}
NO_DEFAULT_PATH
)
if
(
OPENSSL_APPLINK_SOURCE
)
set
(
_OPENSSL_applink_interface_srcs
${
OPENSSL_APPLINK_SOURCE
}
)
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment