Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • c95e2a6
  • /
  • cmake
  • /
  • OpenSSLConfig.cmake.in
Raw File
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:766aebe3d4b745c248bb7c859fca41590fb959ed
directory badge Iframe embedding
swh:1:dir:57573d4532b6ce24c7af2793e66be082f3e69826
OpenSSLConfig.cmake.in
# Generated by OpenSSL
{-
   use lib catdir($config{sourcedir}, 'Configurations');
   use platform;
   use Data::Dumper;

   our %lib_info = (
       map { my %x = ();
             my $lib_static = platform->staticlib($_);
             my $lib_shared =
                 (platform->can("sharedlib_simple")
                  ? platform->sharedlib_simple($_)
                  : undef)
                 // platform->sharedlib($_);
             $x{static} = $lib_static if $lib_static;
             $x{shared} = $lib_shared if $lib_shared;
             if (platform->can("sharedlib_import")) {
                 my $lib_shared_import = platform->sharedlib_import($_);
                 $x{shared_import} = $lib_shared_import if $lib_shared_import;
             }
             %x ? ( $_ => \%x ) : () }
       grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
       @{$unified_info{libraries}}
   );
   our $no_static = !$disabled{shared} && !$lib_info{libcrypto}->{static};
   our $no_shared = $disabled{shared};

   # Unixifying of paths, because that's what CMake understands.
   # This assumes that the given path is absolute.
   sub unixify {
       use File::Spec;
       use File::Spec::Unix;

       my $path = shift;
       my $no_file = shift;
       (my $volume, $directories, $file) = File::Spec->splitpath($path, $no_file // ());
       $directories = File::Spec::Unix->catdir(File::Spec->splitdir($directories));

       # We know that $volume is ignored by File::Spec::Unix, so we handle it specially
       # according to the conventions of the platform.
       $volume =~ s|^(.*?):$|/$1| if $^O eq "vms"; # On VMS, DEV: -> /DEV

       return $volume . File::Spec::Unix->catpath('', $directories, $no_file ? () : $file);
   }
   ""
-}
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

# Avoid duplicate find_package()
set(_ossl_expected_targets OpenSSL::Crypto OpenSSL::SSL
    {- output_off() if $disabled{uplink}; "" -}OpenSSL::applink{- output_on() if $disabled{uplink}; "" -})
set(_ossl_defined_targets)
set(_ossl_undefined_targets)
foreach(t IN LISTS _ossl_expected_targets)
  if(TARGET "${t}")
    LIST(APPEND _ossl_defined_targets "${t}")
  else()
    LIST(APPEND _ossl_undefined_targets "${t}")
  endif()
endforeach()
message(DEBUG "_ossl_expected_targets = ${_ossl_expected_targets}")
message(DEBUG "_ossl_defined_targets = ${_ossl_defined_targets}")
message(DEBUG "_ossl_undefined_targets = ${_ossl_undefined_targets}")
if(NOT _ossl_undefined_targets)
  # All targets are defined, we're good, just undo everything and return
  unset(_ossl_expected_targets)
  unset(_ossl_defined_targets)
  unset(_ossl_undefined_targets)
  unset(CMAKE_IMPORT_FILE_VERSION)
  return()
endif()
if(_ossl_defined_targets)
  # We have a mix of defined and undefined targets.  This is hard to reconcile,
  # and probably the result of another config, or FindOpenSSL.cmake having been
  # called, or whatever.  Therefore, the best course of action is to quit with a
  # hard error.
  message(FATAL_ERROR "Some targets defined, others not:\nNot defined: ${_ossl_undefined_targets}\nDefined: ${_ossl_defined_targets}")
endif()
unset(_ossl_expected_targets)
unset(_ossl_defined_targets)
unset(_ossl_undefined_targets)

{-
  # It can be argued that 'cmake_path' would be the better choice here.  However,
  # cmake_path is relatively new, while get_filename_component has been around
  # since before CMake 3.0
-}
# Set up the import path, so all other import paths are made relative this file
get_filename_component(_ossl_prefix "${CMAKE_CURRENT_LIST_FILE}" PATH)
{-
  # For each component in $OpenSSL::safe::installdata::CMAKECONFIGDIR[0] relative to
  # $OpenSSL::safe::installdata::PREFIX[0], have CMake figure out the parent directory.
  my $d = join('/', unixify(catdir($OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0],
                                   $OpenSSL::safe::installdata::CMAKECONFIGDIR_REL_LIBDIR[0]), 1));
  $OUT = '';
  if ($d ne '.') {
      $OUT .= 'get_filename_component(_ossl_prefix "${_ossl_prefix}" PATH)' . "\n"
          foreach (split '/', $d);
  }
-}
if(_ossl_prefix STREQUAL "/")
  set(_ossl_prefix "")
endif()

{- output_off() unless $disabled{shared}; "" -}
set(_ossl_use_static_libs True)
{- output_on() unless $disabled{shared}; "" -}
if(OPENSSL_USE_STATIC_LIBS)
  set(_ossl_use_static_libs True)
elseif(DEFINED OPENSSL_USE_STATIC_LIBS)
  # We know OPENSSL_USE_STATIC_LIBS is defined and False
  if(_ossl_use_static_libs)
    # OPENSSL_USE_STATIC_LIBS is explicitly false, indicating that shared libraries are
    # required.  However, _ossl_use_static_libs indicates that no shared libraries are
    # available.  The best course of action is to simply return and leave it to CMake to
    # use another OpenSSL config.
    unset(_ossl_use_static_libs)
    unset(CMAKE_IMPORT_FILE_VERSION)
    return()
  endif()
endif()

# Version, copied from what find_package() gives, for compatibility with FindOpenSSL.cmake
set(OPENSSL_VERSION "${OpenSSL_VERSION}")
set(OPENSSL_VERSION_MAJOR "${OpenSSL_VERSION_MAJOR}")
set(OPENSSL_VERSION_MINOR "${OpenSSL_VERSION_MINOR}")
set(OPENSSL_VERSION_FIX "${OpenSSL_VERSION_PATCH}")
set(OPENSSL_FOUND YES)

# Directories and names
set(OPENSSL_LIBRARY_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0], 1); -}")
set(OPENSSL_INCLUDE_DIR{- $OUT = '';
                          $OUT .= ' "${_ossl_prefix}/' . $_ . '"'
                              foreach (@OpenSSL::safe::installdata::INCLUDEDIR_REL_PREFIX); -})
set(OPENSSL_ENGINES_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0], 1); -}/{- unixify($OpenSSL::safe::installdata::ENGINESDIR_REL_LIBDIR[0], 1); -}")
set(OPENSSL_MODULES_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0], 1); -}/{- unixify($OpenSSL::safe::installdata::MODULESDIR_REL_LIBDIR[0], 1); -}")
set(OPENSSL_RUNTIME_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::BINDIR_REL_PREFIX[0], 1); -}")
{- output_off() if $disabled{uplink}; "" -}
set(OPENSSL_APPLINK_SOURCE "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::APPLINKDIR_REL_PREFIX[0], 1); -}/applink.c")
{- output_on() if $disabled{uplink}; "" -}
set(OPENSSL_PROGRAM "${OPENSSL_RUNTIME_DIR}/{- platform->bin('openssl') -}")

# Set up the imported targets
if(_ossl_use_static_libs)
{- output_off() unless $no_static; "" -}
  # Static libraries are UNSUPPORTED in this configuration
{- output_on() unless $no_static; output_off() if $no_static; "" -}
  add_library(OpenSSL::Crypto STATIC IMPORTED)
  add_library(OpenSSL::SSL STATIC IMPORTED)

  set(OPENSSL_LIBCRYPTO_STATIC "${OPENSSL_LIBRARY_DIR}/{- $lib_info{libcrypto}->{static} -}")
  set(OPENSSL_LIBCRYPTO_DEPENDENCIES {- join(' ', @OpenSSL::safe::installdata::LDLIBS) -})
  set_target_properties(OpenSSL::Crypto PROPERTIES
    IMPORTED_LINK_INTERFACE_LANGUAGES "C"
    IMPORTED_LOCATION ${OPENSSL_LIBCRYPTO_STATIC})
  set_property(TARGET OpenSSL::Crypto
    PROPERTY INTERFACE_LINK_LIBRARIES ${OPENSSL_LIBCRYPTO_DEPENDENCIES})

  set(OPENSSL_LIBSSL_STATIC "${OPENSSL_LIBRARY_DIR}/{- $lib_info{libssl}->{static} -}")
  set(OPENSSL_LIBSSL_DEPENDENCIES OpenSSL::Crypto)
  set_target_properties(OpenSSL::SSL PROPERTIES
    IMPORTED_LINK_INTERFACE_LANGUAGES "C"
    IMPORTED_LOCATION ${OPENSSL_LIBSSL_STATIC})
  set_property(TARGET OpenSSL::SSL
    PROPERTY INTERFACE_LINK_LIBRARIES ${OPENSSL_LIBSSL_DEPENDENCIES})

  # Directories and names compatible with CMake's FindOpenSSL.cmake
  set(OPENSSL_CRYPTO_LIBRARY ${OPENSSL_LIBCRYPTO_STATIC})
  set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_LIBCRYPTO_DEPENDENCIES})
  set(OPENSSL_SSL_LIBRARY ${OPENSSL_LIBSSL_STATIC})
  set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_LIBSSL_DEPENDENCIES})
  set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_LIBSSL_DEPENDENCIES} ${OPENSSL_LIBCRYPTO_DEPENDENCIES})
{- output_on(); "" -}
else()
{- output_off() unless $no_shared; "" -}
  # Shared libraries are UNSUPPORTED in this configuration
{- output_on() unless $no_shared;
   output_off() if $no_shared; "" -}
  add_library(OpenSSL::Crypto SHARED IMPORTED)
  add_library(OpenSSL::SSL SHARED IMPORTED)
{- output_off() unless $lib_info{libcrypto}->{shared_import}; "" -}
  set(OPENSSL_LIBCRYPTO_SHARED "${OPENSSL_RUNTIME_DIR}/{- $lib_info{libcrypto}->{shared} -}")
  set(OPENSSL_LIBCRYPTO_IMPORT "${OPENSSL_LIBRARY_DIR}/{- $lib_info{libcrypto}->{shared_import} -}")
  set(OPENSSL_LIBCRYPTO_DEPENDENCIES {- join(' ', @LDLIBS) -})
  set_target_properties(OpenSSL::Crypto PROPERTIES
    IMPORTED_LINK_INTERFACE_LANGUAGES "C"
    IMPORTED_IMPLIB ${OPENSSL_LIBCRYPTO_IMPORT}
    IMPORTED_LOCATION ${OPENSSL_LIBCRYPTO_SHARED})
  set_property(TARGET OpenSSL::Crypto
    PROPERTY INTERFACE_LINK_LIBRARIES ${OPENSSL_LIBCRYPTO_DEPENDENCIES})

  set(OPENSSL_LIBSSL_SHARED "${OPENSSL_RUNTIME_DIR}/{- $lib_info{libssl}->{shared} -}")
  set(OPENSSL_LIBSSL_IMPORT "${OPENSSL_LIBRARY_DIR}/{- $lib_info{libssl}->{shared_import} -}")
  set(OPENSSL_LIBSSL_DEPENDENCIES OpenSSL::Crypto {- join(' ', @LDLIBS) -})
  set_target_properties(OpenSSL::SSL PROPERTIES
    IMPORTED_LINK_INTERFACE_LANGUAGES "C"
    IMPORTED_IMPLIB ${OPENSSL_LIBSSL_IMPORT}
    IMPORTED_LOCATION ${OPENSSL_LIBSSL_SHARED})
  set_property(TARGET OpenSSL::SSL
    PROPERTY INTERFACE_LINK_LIBRARIES ${OPENSSL_LIBSSL_DEPENDENCIES})

  # Directories and names compatible with CMake's FindOpenSSL.cmake
  set(OPENSSL_CRYPTO_LIBRARY ${OPENSSL_LIBCRYPTO_IMPORT})
  set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_LIBCRYPTO_DEPENDENCIES})
  set(OPENSSL_SSL_LIBRARY ${OPENSSL_LIBSSL_IMPORT})
  set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_LIBSSL_DEPENDENCIES})
  set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_LIBSSL_DEPENDENCIES} ${OPENSSL_LIBCRYPTO_DEPENDENCIES})
{- output_on() unless $lib_info{libcrypto}->{shared_import};
   output_off() if $lib_info{libcrypto}->{shared_import}; "" -}
  # Dependencies are assumed to be implied in the shared libraries
  set(OPENSSL_LIBCRYPTO_SHARED "${OPENSSL_LIBRARY_DIR}/{- $lib_info{libcrypto}->{shared} -}")
  set_target_properties(OpenSSL::Crypto PROPERTIES
    IMPORTED_LINK_INTERFACE_LANGUAGES "C"
    IMPORTED_LOCATION ${OPENSSL_LIBCRYPTO_SHARED})

  set(OPENSSL_LIBSSL_SHARED "${OPENSSL_LIBRARY_DIR}/{- $lib_info{libssl}->{shared} -}")
  set_target_properties(OpenSSL::SSL PROPERTIES
    IMPORTED_LINK_INTERFACE_LANGUAGES "C"
    IMPORTED_LOCATION ${OPENSSL_LIBSSL_SHARED})

  # Directories and names compatible with CMake's FindOpenSSL.cmake
  set(OPENSSL_CRYPTO_LIBRARY ${OPENSSL_LIBCRYPTO_SHARED})
  set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
  set(OPENSSL_SSL_LIBRARY ${OPENSSL_LIBSSL_SHARED})
  set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY})
  set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES})
{- output_on() if $lib_info{libcrypto}->{shared_import}; "" -}
{- output_on() if $no_shared; "" -}
endif()

set_target_properties(OpenSSL::Crypto PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}")
set_target_properties(OpenSSL::SSL PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}")

{- output_off() if $disabled{uplink}; "" -}
add_library(OpenSSL::applink INTERFACE IMPORTED)
set_property(TARGET OpenSSL::applink PROPERTY
  INTERFACE_SOURCES "${OPENSSL_APPLINK_SOURCE}")
{- output_on() if $disabled{uplink}; "" -}

unset(_ossl_prefix)
unset(_ossl_use_static_libs)

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top