1# Copyright 2022 The BoringSSL Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15include(${CMAKE_CURRENT_LIST_DIR}/OpenSSLTargets.cmake)
16
17# Recursively collect dependency locations for the imported targets.
18macro(_openssl_config_libraries libraries target)
19  get_property(_DEPS TARGET ${target} PROPERTY INTERFACE_LINK_LIBRARIES)
20  foreach(_DEP ${_DEPS})
21    if(TARGET ${_DEP})
22      _openssl_config_libraries(${libraries} ${_DEP})
23    else()
24      list(APPEND ${libraries} ${_DEP})
25    endif()
26  endforeach()
27  get_property(_LOC TARGET ${target} PROPERTY LOCATION)
28  list(APPEND ${libraries} ${_LOC})
29endmacro()
30
31set(OPENSSL_FOUND YES)
32get_property(OPENSSL_INCLUDE_DIR TARGET OpenSSL::SSL PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
33get_property(OPENSSL_CRYPTO_LIBRARY TARGET OpenSSL::Crypto PROPERTY LOCATION)
34_openssl_config_libraries(OPENSSL_CRYPTO_LIBRARIES OpenSSL::Crypto)
35list(REMOVE_DUPLICATES OPENSSL_CRYPTO_LIBRARIES)
36
37get_property(OPENSSL_SSL_LIBRARY TARGET OpenSSL::Crypto PROPERTY LOCATION)
38_openssl_config_libraries(OPENSSL_SSL_LIBRARIES OpenSSL::SSL)
39list(REMOVE_DUPLICATES OPENSSL_SSL_LIBRARIES)
40
41set(OPENSSL_LIBRARIES ${OPENSSL_CRYPTO_LIBRARIES} ${OPENSSL_SSL_LIBRARIES})
42list(REMOVE_DUPLICATES OPENSSL_LIBRARIES)
43
44set(_DEP)
45set(_DEPS)
46set(_LOC)
47