This template file is made to make both:
1. OpenSSLConfig.cmake (CMake config used when building a CMake package
against an uninstalled OpenSSL build)
2. exporters/OpenSSLConfig.cmake (CMake config that's to be installed
alongside OpenSSL, and is used when building a CMake package against
an OpenSSL installation).
Variant 1 was unfortunately getting the internal '_ossl_prefix' variable
wrong, which is due to how the perl snippet builds the command(s) to figure
out its value. That needed some correction.
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24918)
(cherry picked from commit
a82d9e572cc757e4fa50d484bfbb7115f2d027dd)
{-
# For each component in $OpenSSL::safe::installdata::CMAKECONFIGDIR relative to
# $OpenSSL::safe::installdata::PREFIX, have CMake figure out the parent directory.
- my $d = join('/', unixify($OpenSSL::safe::installdata::LIBDIR_REL_PREFIX),
- unixify($OpenSSL::safe::installdata::CMAKECONFIGDIR_REL_LIBDIR));
+ my $d = join('/', unixify(catdir($OpenSSL::safe::installdata::LIBDIR_REL_PREFIX,
+ $OpenSSL::safe::installdata::CMAKECONFIGDIR_REL_LIBDIR), 1));
$OUT = '';
- $OUT .= 'get_filename_component(_ossl_prefix "${_ossl_prefix}" PATH)' . "\n"
- foreach (split '/', $d);
+ if ($d ne '.') {
+ $OUT .= 'get_filename_component(_ossl_prefix "${_ossl_prefix}" PATH)' . "\n"
+ foreach (split '/', $d);
+ }
-}
if(_ossl_prefix STREQUAL "/")
set(_ossl_prefix "")