1 1.1 christos # Generated by OpenSSL 2 1.1.1.3 christos # {- $OpenSSL::safe::installdata::COMMENT // "" -} 3 1.1 christos {- 4 1.1 christos use lib catdir($config{sourcedir}, 'Configurations'); 5 1.1 christos use platform; 6 1.1 christos 7 1.1 christos our %lib_info = ( 8 1.1 christos map { my %x = (); 9 1.1 christos my $lib_static = platform->staticlib($_); 10 1.1 christos my $lib_shared = 11 1.1 christos (platform->can("sharedlib_simple") 12 1.1 christos ? platform->sharedlib_simple($_) 13 1.1 christos : undef) 14 1.1 christos // platform->sharedlib($_); 15 1.1 christos $x{static} = $lib_static if $lib_static; 16 1.1 christos $x{shared} = $lib_shared if $lib_shared; 17 1.1 christos if (platform->can("sharedlib_import")) { 18 1.1 christos my $lib_shared_import = platform->sharedlib_import($_); 19 1.1 christos $x{shared_import} = $lib_shared_import if $lib_shared_import; 20 1.1 christos } 21 1.1 christos %x ? ( $_ => \%x ) : () } 22 1.1 christos grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } 23 1.1 christos @{$unified_info{libraries}} 24 1.1 christos ); 25 1.1 christos our $no_static = !$disabled{shared} && !$lib_info{libcrypto}->{static}; 26 1.1 christos our $no_shared = $disabled{shared}; 27 1.1 christos 28 1.1 christos # Unixifying of paths, because that's what CMake understands. 29 1.1 christos # This assumes that the given path is absolute. 30 1.1 christos sub unixify { 31 1.1 christos use File::Spec; 32 1.1 christos use File::Spec::Unix; 33 1.1 christos 34 1.1 christos my $path = shift; 35 1.1 christos my $no_file = shift; 36 1.1 christos (my $volume, $directories, $file) = File::Spec->splitpath($path, $no_file // ()); 37 1.1 christos $directories = File::Spec::Unix->catdir(File::Spec->splitdir($directories)); 38 1.1 christos 39 1.1 christos # We know that $volume is ignored by File::Spec::Unix, so we handle it specially 40 1.1 christos # according to the conventions of the platform. 41 1.1 christos $volume =~ s|^(.*?):$|/$1| if $^O eq "vms"; # On VMS, DEV: -> /DEV 42 1.1 christos 43 1.1 christos return $volume . File::Spec::Unix->catpath('', $directories, $no_file ? () : $file); 44 1.1 christos } 45 1.1 christos "" 46 1.1 christos -} 47 1.1 christos # Commands may need to know the format version. 48 1.1 christos set(CMAKE_IMPORT_FILE_VERSION 1) 49 1.1 christos 50 1.1 christos # Avoid duplicate find_package() 51 1.1 christos set(_ossl_expected_targets OpenSSL::Crypto OpenSSL::SSL 52 1.1 christos {- output_off() if $disabled{uplink}; "" -}OpenSSL::applink{- output_on() if $disabled{uplink}; "" -}) 53 1.1 christos set(_ossl_defined_targets) 54 1.1 christos set(_ossl_undefined_targets) 55 1.1 christos foreach(t IN LISTS _ossl_expected_targets) 56 1.1 christos if(TARGET "${t}") 57 1.1 christos LIST(APPEND _ossl_defined_targets "${t}") 58 1.1 christos else() 59 1.1 christos LIST(APPEND _ossl_undefined_targets "${t}") 60 1.1 christos endif() 61 1.1 christos endforeach() 62 1.1 christos message(DEBUG "_ossl_expected_targets = ${_ossl_expected_targets}") 63 1.1 christos message(DEBUG "_ossl_defined_targets = ${_ossl_defined_targets}") 64 1.1 christos message(DEBUG "_ossl_undefined_targets = ${_ossl_undefined_targets}") 65 1.1 christos if(NOT _ossl_undefined_targets) 66 1.1 christos # All targets are defined, we're good, just undo everything and return 67 1.1 christos unset(_ossl_expected_targets) 68 1.1 christos unset(_ossl_defined_targets) 69 1.1 christos unset(_ossl_undefined_targets) 70 1.1 christos unset(CMAKE_IMPORT_FILE_VERSION) 71 1.1 christos return() 72 1.1 christos endif() 73 1.1 christos if(_ossl_defined_targets) 74 1.1 christos # We have a mix of defined and undefined targets. This is hard to reconcile, 75 1.1 christos # and probably the result of another config, or FindOpenSSL.cmake having been 76 1.1 christos # called, or whatever. Therefore, the best course of action is to quit with a 77 1.1 christos # hard error. 78 1.1 christos message(FATAL_ERROR "Some targets defined, others not:\nNot defined: ${_ossl_undefined_targets}\nDefined: ${_ossl_defined_targets}") 79 1.1 christos endif() 80 1.1 christos unset(_ossl_expected_targets) 81 1.1 christos unset(_ossl_defined_targets) 82 1.1 christos unset(_ossl_undefined_targets) 83 1.1 christos 84 1.1 christos {- 85 1.1 christos # It can be argued that 'cmake_path' would be the better choice here. However, 86 1.1 christos # cmake_path is relatively new, while get_filename_component has been around 87 1.1 christos # since before CMake 3.0 88 1.1 christos -} 89 1.1 christos # Set up the import path, so all other import paths are made relative this file 90 1.1 christos get_filename_component(_ossl_prefix "${CMAKE_CURRENT_LIST_FILE}" PATH) 91 1.1 christos {- 92 1.1 christos # For each component in $OpenSSL::safe::installdata::CMAKECONFIGDIR[0] relative to 93 1.1 christos # $OpenSSL::safe::installdata::PREFIX[0], have CMake figure out the parent directory. 94 1.1 christos my $d = join('/', unixify(catdir($OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0], 95 1.1 christos $OpenSSL::safe::installdata::CMAKECONFIGDIR_REL_LIBDIR[0]), 1)); 96 1.1 christos $OUT = ''; 97 1.1 christos if ($d ne '.') { 98 1.1 christos $OUT .= 'get_filename_component(_ossl_prefix "${_ossl_prefix}" PATH)' . "\n" 99 1.1 christos foreach (split '/', $d); 100 1.1 christos } 101 1.1 christos -} 102 1.1 christos if(_ossl_prefix STREQUAL "/") 103 1.1 christos set(_ossl_prefix "") 104 1.1 christos endif() 105 1.1 christos 106 1.1 christos {- output_off() unless $disabled{shared}; "" -} 107 1.1 christos set(_ossl_use_static_libs True) 108 1.1 christos {- output_on() unless $disabled{shared}; "" -} 109 1.1 christos if(OPENSSL_USE_STATIC_LIBS) 110 1.1 christos set(_ossl_use_static_libs True) 111 1.1 christos elseif(DEFINED OPENSSL_USE_STATIC_LIBS) 112 1.1 christos # We know OPENSSL_USE_STATIC_LIBS is defined and False 113 1.1 christos if(_ossl_use_static_libs) 114 1.1 christos # OPENSSL_USE_STATIC_LIBS is explicitly false, indicating that shared libraries are 115 1.1 christos # required. However, _ossl_use_static_libs indicates that no shared libraries are 116 1.1 christos # available. The best course of action is to simply return and leave it to CMake to 117 1.1 christos # use another OpenSSL config. 118 1.1 christos unset(_ossl_use_static_libs) 119 1.1 christos unset(CMAKE_IMPORT_FILE_VERSION) 120 1.1 christos return() 121 1.1 christos endif() 122 1.1 christos endif() 123 1.1 christos 124 1.1 christos # Version, copied from what find_package() gives, for compatibility with FindOpenSSL.cmake 125 1.1 christos set(OPENSSL_VERSION "${OpenSSL_VERSION}") 126 1.1 christos set(OPENSSL_VERSION_MAJOR "${OpenSSL_VERSION_MAJOR}") 127 1.1 christos set(OPENSSL_VERSION_MINOR "${OpenSSL_VERSION_MINOR}") 128 1.1 christos set(OPENSSL_VERSION_FIX "${OpenSSL_VERSION_PATCH}") 129 1.1 christos set(OPENSSL_FOUND YES) 130 1.1 christos 131 1.1 christos # Directories and names 132 1.1 christos set(OPENSSL_LIBRARY_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0], 1); -}") 133 1.1 christos set(OPENSSL_INCLUDE_DIR{- $OUT = ''; 134 1.1 christos $OUT .= ' "${_ossl_prefix}/' . $_ . '"' 135 1.1 christos foreach (@OpenSSL::safe::installdata::INCLUDEDIR_REL_PREFIX); -}) 136 1.1 christos set(OPENSSL_ENGINES_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0], 1); -}/{- unixify($OpenSSL::safe::installdata::ENGINESDIR_REL_LIBDIR[0], 1); -}") 137 1.1 christos set(OPENSSL_MODULES_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0], 1); -}/{- unixify($OpenSSL::safe::installdata::MODULESDIR_REL_LIBDIR[0], 1); -}") 138 1.1 christos set(OPENSSL_RUNTIME_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::BINDIR_REL_PREFIX[0], 1); -}") 139 1.1 christos {- output_off() if $disabled{uplink}; "" -} 140 1.1 christos set(OPENSSL_APPLINK_SOURCE "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::APPLINKDIR_REL_PREFIX[0], 1); -}/applink.c") 141 1.1 christos {- output_on() if $disabled{uplink}; "" -} 142 1.1 christos set(OPENSSL_PROGRAM "${OPENSSL_RUNTIME_DIR}/{- platform->bin('openssl') -}") 143 1.1 christos 144 1.1 christos # Set up the imported targets 145 1.1 christos if(_ossl_use_static_libs) 146 1.1 christos {- output_off() unless $no_static; "" -} 147 1.1 christos # Static libraries are UNSUPPORTED in this configuration 148 1.1 christos {- output_on() unless $no_static; output_off() if $no_static; "" -} 149 1.1 christos add_library(OpenSSL::Crypto STATIC IMPORTED) 150 1.1 christos add_library(OpenSSL::SSL STATIC IMPORTED) 151 1.1 christos 152 1.1 christos set(OPENSSL_LIBCRYPTO_STATIC "${OPENSSL_LIBRARY_DIR}/{- $lib_info{libcrypto}->{static} -}") 153 1.1 christos set(OPENSSL_LIBCRYPTO_DEPENDENCIES {- join(' ', @OpenSSL::safe::installdata::LDLIBS) -}) 154 1.1 christos set_target_properties(OpenSSL::Crypto PROPERTIES 155 1.1 christos IMPORTED_LINK_INTERFACE_LANGUAGES "C" 156 1.1 christos IMPORTED_LOCATION ${OPENSSL_LIBCRYPTO_STATIC}) 157 1.1 christos set_property(TARGET OpenSSL::Crypto 158 1.1 christos PROPERTY INTERFACE_LINK_LIBRARIES ${OPENSSL_LIBCRYPTO_DEPENDENCIES}) 159 1.1 christos 160 1.1 christos set(OPENSSL_LIBSSL_STATIC "${OPENSSL_LIBRARY_DIR}/{- $lib_info{libssl}->{static} -}") 161 1.1 christos set(OPENSSL_LIBSSL_DEPENDENCIES OpenSSL::Crypto) 162 1.1 christos set_target_properties(OpenSSL::SSL PROPERTIES 163 1.1 christos IMPORTED_LINK_INTERFACE_LANGUAGES "C" 164 1.1 christos IMPORTED_LOCATION ${OPENSSL_LIBSSL_STATIC}) 165 1.1 christos set_property(TARGET OpenSSL::SSL 166 1.1 christos PROPERTY INTERFACE_LINK_LIBRARIES ${OPENSSL_LIBSSL_DEPENDENCIES}) 167 1.1 christos 168 1.1 christos # Directories and names compatible with CMake's FindOpenSSL.cmake 169 1.1 christos set(OPENSSL_CRYPTO_LIBRARY ${OPENSSL_LIBCRYPTO_STATIC}) 170 1.1 christos set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_LIBCRYPTO_DEPENDENCIES}) 171 1.1 christos set(OPENSSL_SSL_LIBRARY ${OPENSSL_LIBSSL_STATIC}) 172 1.1 christos set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_LIBSSL_DEPENDENCIES}) 173 1.1 christos set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_LIBSSL_DEPENDENCIES} ${OPENSSL_LIBCRYPTO_DEPENDENCIES}) 174 1.1 christos {- output_on(); "" -} 175 1.1 christos else() 176 1.1 christos {- output_off() unless $no_shared; "" -} 177 1.1 christos # Shared libraries are UNSUPPORTED in this configuration 178 1.1 christos {- output_on() unless $no_shared; 179 1.1 christos output_off() if $no_shared; "" -} 180 1.1 christos add_library(OpenSSL::Crypto SHARED IMPORTED) 181 1.1 christos add_library(OpenSSL::SSL SHARED IMPORTED) 182 1.1 christos {- output_off() unless $lib_info{libcrypto}->{shared_import}; "" -} 183 1.1 christos set(OPENSSL_LIBCRYPTO_SHARED "${OPENSSL_RUNTIME_DIR}/{- $lib_info{libcrypto}->{shared} -}") 184 1.1 christos set(OPENSSL_LIBCRYPTO_IMPORT "${OPENSSL_LIBRARY_DIR}/{- $lib_info{libcrypto}->{shared_import} -}") 185 1.1 christos set(OPENSSL_LIBCRYPTO_DEPENDENCIES {- join(' ', @LDLIBS) -}) 186 1.1 christos set_target_properties(OpenSSL::Crypto PROPERTIES 187 1.1 christos IMPORTED_LINK_INTERFACE_LANGUAGES "C" 188 1.1 christos IMPORTED_IMPLIB ${OPENSSL_LIBCRYPTO_IMPORT} 189 1.1 christos IMPORTED_LOCATION ${OPENSSL_LIBCRYPTO_SHARED}) 190 1.1 christos set_property(TARGET OpenSSL::Crypto 191 1.1 christos PROPERTY INTERFACE_LINK_LIBRARIES ${OPENSSL_LIBCRYPTO_DEPENDENCIES}) 192 1.1 christos 193 1.1 christos set(OPENSSL_LIBSSL_SHARED "${OPENSSL_RUNTIME_DIR}/{- $lib_info{libssl}->{shared} -}") 194 1.1 christos set(OPENSSL_LIBSSL_IMPORT "${OPENSSL_LIBRARY_DIR}/{- $lib_info{libssl}->{shared_import} -}") 195 1.1 christos set(OPENSSL_LIBSSL_DEPENDENCIES OpenSSL::Crypto {- join(' ', @LDLIBS) -}) 196 1.1 christos set_target_properties(OpenSSL::SSL PROPERTIES 197 1.1 christos IMPORTED_LINK_INTERFACE_LANGUAGES "C" 198 1.1 christos IMPORTED_IMPLIB ${OPENSSL_LIBSSL_IMPORT} 199 1.1 christos IMPORTED_LOCATION ${OPENSSL_LIBSSL_SHARED}) 200 1.1 christos set_property(TARGET OpenSSL::SSL 201 1.1 christos PROPERTY INTERFACE_LINK_LIBRARIES ${OPENSSL_LIBSSL_DEPENDENCIES}) 202 1.1 christos 203 1.1 christos # Directories and names compatible with CMake's FindOpenSSL.cmake 204 1.1 christos set(OPENSSL_CRYPTO_LIBRARY ${OPENSSL_LIBCRYPTO_IMPORT}) 205 1.1 christos set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_LIBCRYPTO_DEPENDENCIES}) 206 1.1 christos set(OPENSSL_SSL_LIBRARY ${OPENSSL_LIBSSL_IMPORT}) 207 1.1 christos set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_LIBSSL_DEPENDENCIES}) 208 1.1 christos set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_LIBSSL_DEPENDENCIES} ${OPENSSL_LIBCRYPTO_DEPENDENCIES}) 209 1.1 christos {- output_on() unless $lib_info{libcrypto}->{shared_import}; 210 1.1 christos output_off() if $lib_info{libcrypto}->{shared_import}; "" -} 211 1.1 christos # Dependencies are assumed to be implied in the shared libraries 212 1.1 christos set(OPENSSL_LIBCRYPTO_SHARED "${OPENSSL_LIBRARY_DIR}/{- $lib_info{libcrypto}->{shared} -}") 213 1.1 christos set_target_properties(OpenSSL::Crypto PROPERTIES 214 1.1 christos IMPORTED_LINK_INTERFACE_LANGUAGES "C" 215 1.1 christos IMPORTED_LOCATION ${OPENSSL_LIBCRYPTO_SHARED}) 216 1.1 christos 217 1.1 christos set(OPENSSL_LIBSSL_SHARED "${OPENSSL_LIBRARY_DIR}/{- $lib_info{libssl}->{shared} -}") 218 1.1 christos set_target_properties(OpenSSL::SSL PROPERTIES 219 1.1 christos IMPORTED_LINK_INTERFACE_LANGUAGES "C" 220 1.1 christos IMPORTED_LOCATION ${OPENSSL_LIBSSL_SHARED}) 221 1.1 christos 222 1.1 christos # Directories and names compatible with CMake's FindOpenSSL.cmake 223 1.1 christos set(OPENSSL_CRYPTO_LIBRARY ${OPENSSL_LIBCRYPTO_SHARED}) 224 1.1 christos set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) 225 1.1 christos set(OPENSSL_SSL_LIBRARY ${OPENSSL_LIBSSL_SHARED}) 226 1.1 christos set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY}) 227 1.1 christos set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES}) 228 1.1 christos {- output_on() if $lib_info{libcrypto}->{shared_import}; "" -} 229 1.1 christos {- output_on() if $no_shared; "" -} 230 1.1 christos endif() 231 1.1 christos 232 1.1 christos set_target_properties(OpenSSL::Crypto PROPERTIES 233 1.1 christos INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}") 234 1.1 christos set_target_properties(OpenSSL::SSL PROPERTIES 235 1.1 christos INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}") 236 1.1 christos 237 1.1 christos {- output_off() if $disabled{uplink}; "" -} 238 1.1 christos add_library(OpenSSL::applink INTERFACE IMPORTED) 239 1.1 christos set_property(TARGET OpenSSL::applink PROPERTY 240 1.1 christos INTERFACE_SOURCES "${OPENSSL_APPLINK_SOURCE}") 241 1.1 christos {- output_on() if $disabled{uplink}; "" -} 242 1.1 christos 243 1.1 christos unset(_ossl_prefix) 244 1.1 christos unset(_ossl_use_static_libs) 245