aboutsummaryrefslogtreecommitdiff
path: root/cmake/OpenSSLConfig.cmake
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2023-01-29 15:17:38 -0500
committerBoringssl LUCI CQ <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-02-01 20:07:18 +0000
commit31f1466a613774369053a94eabbae38fb9cbb7f9 (patch)
tree1604725c59318a99ce62a7417a16d3767ddbce42 /cmake/OpenSSLConfig.cmake
parenta1c79226137e8f60ed572dabdd2435f1f942be0f (diff)
downloadboringssl-31f1466a613774369053a94eabbae38fb9cbb7f9.zip
boringssl-31f1466a613774369053a94eabbae38fb9cbb7f9.tar.gz
boringssl-31f1466a613774369053a94eabbae38fb9cbb7f9.tar.bz2
Move OpenSSLConfig.cmake into the cmake/ directory
We've already put perlasm.cmake in there. I figure CMake helper files can go in there. It also seems to match what other projects too. Change-Id: Ief6b10cf4e80b8d4b52ca53b90aa425b32037e52 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/56566 Auto-Submit: David Benjamin <davidben@google.com> Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: David Benjamin <davidben@google.com>
Diffstat (limited to 'cmake/OpenSSLConfig.cmake')
-rw-r--r--cmake/OpenSSLConfig.cmake32
1 files changed, 32 insertions, 0 deletions
diff --git a/cmake/OpenSSLConfig.cmake b/cmake/OpenSSLConfig.cmake
new file mode 100644
index 0000000..3ebaf19
--- /dev/null
+++ b/cmake/OpenSSLConfig.cmake
@@ -0,0 +1,32 @@
+include(${CMAKE_CURRENT_LIST_DIR}/OpenSSLTargets.cmake)
+
+# Recursively collect dependency locations for the imported targets.
+macro(_openssl_config_libraries libraries target)
+ get_property(_DEPS TARGET ${target} PROPERTY INTERFACE_LINK_LIBRARIES)
+ foreach(_DEP ${_DEPS})
+ if(TARGET ${_DEP})
+ _openssl_config_libraries(${libraries} ${_DEP})
+ else()
+ list(APPEND ${libraries} ${_DEP})
+ endif()
+ endforeach()
+ get_property(_LOC TARGET ${target} PROPERTY LOCATION)
+ list(APPEND ${libraries} ${_LOC})
+endmacro()
+
+set(OPENSSL_FOUND YES)
+get_property(OPENSSL_INCLUDE_DIR TARGET OpenSSL::SSL PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
+get_property(OPENSSL_CRYPTO_LIBRARY TARGET OpenSSL::Crypto PROPERTY LOCATION)
+_openssl_config_libraries(OPENSSL_CRYPTO_LIBRARIES OpenSSL::Crypto)
+list(REMOVE_DUPLICATES OPENSSL_CRYPTO_LIBRARIES)
+
+get_property(OPENSSL_SSL_LIBRARY TARGET OpenSSL::Crypto PROPERTY LOCATION)
+_openssl_config_libraries(OPENSSL_SSL_LIBRARIES OpenSSL::SSL)
+list(REMOVE_DUPLICATES OPENSSL_SSL_LIBRARIES)
+
+set(OPENSSL_LIBRARIES ${OPENSSL_CRYPTO_LIBRARIES} ${OPENSSL_SSL_LIBRARIES})
+list(REMOVE_DUPLICATES OPENSSL_LIBRARIES)
+
+set(_DEP)
+set(_DEPS)
+set(_LOC)