Browse Source

exporters/cmake/OpenSSLConfig.cmake.in: Detect missing `platform->sharedlib_import`

Some platform implementations are without `sharedlib_import()`, so we need
to check that it exists before using it.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/22789)
Richard Levitte 5 months ago
parent
commit
dd5fe94a61
1 changed files with 4 additions and 2 deletions
  1. 4 2
      exporters/cmake/OpenSSLConfig.cmake.in

+ 4 - 2
exporters/cmake/OpenSSLConfig.cmake.in

@@ -12,10 +12,12 @@
                   ? platform->sharedlib_simple($_)
                   : undef)
                  // platform->sharedlib($_);
-             my $lib_shared_import = platform->sharedlib_import($_);
              $x{static} = $lib_static if $lib_static;
              $x{shared} = $lib_shared if $lib_shared;
-             $x{shared_import} = $lib_shared_import if $lib_shared_import;
+             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}}