File: FindOpenSSL.cmake

package info (click to toggle)
cyclonedds 0.10.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 21,372 kB
  • sloc: ansic: 224,361; perl: 1,904; xml: 1,894; yacc: 1,018; sh: 882; python: 106; makefile: 94
file content (42 lines) | stat: -rw-r--r-- 1,628 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#
# Copyright(c) 2006 to 2021 ZettaScale Technology and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
if(TARGET CONAN_PKG::openssl)
  add_library(OpenSSL::SSL INTERFACE IMPORTED)
  target_link_libraries(OpenSSL::SSL INTERFACE CONAN_PKG::openssl)
  set(OPENSSL_FOUND TRUE)
else()
  # Loop over a list of possible module paths (without the current directory).
  get_filename_component(DIR "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE)

  foreach(MODULE_DIR ${CMAKE_MODULE_PATH} ${CMAKE_ROOT}/Modules)
    get_filename_component(MODULE_DIR "${MODULE_DIR}" ABSOLUTE)
    if(NOT MODULE_DIR STREQUAL DIR)
      if(EXISTS "${MODULE_DIR}/FindOpenSSL.cmake")
        set(FIND_PACKAGE_FILE "${MODULE_DIR}/FindOpenSSL.cmake")
        break()
      endif()
    endif()
  endforeach()

  if(FIND_PACKAGE_FILE)
    include("${FIND_PACKAGE_FILE}")
  endif()
endif()

# OpenSSL DLL on Windows: use of BIO_s_fd and BIO_s_file (directly or indirectly) requires
# the executable to incorporate OpenSSL applink.c.  CMake 18 adds support for handling
# this as part of the OpenSSL package, but we can't require such a new CMake version.
if(OPENSSL_FOUND AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/applink.c")
  set(CYCLONEDDS_OPENSSL_APPLINK "${OPENSSL_INCLUDE_DIR}/openssl/applink.c")
else()
  set(CYCLONEDDS_OPENSSL_APPLINK "")
endif()