mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 10:59:00 +08:00
8d1bb02da0
Based on #38118, credits: @talregev. OpenSSL now installs a CMake config, but it is not generated by CMake, and it is not multi-config capable. This limitation affects location properties, interface link libraries and package variables. This PR just patches the config to chainload CMake's Find module. Together with vcpkg's cmake wrapper, this immediately gives the desired imported targets in a multi-config configuration when a user really requests `OpenSSL CONFIG`. --------- Co-authored-by: Tal Regev <tal.regev@gmail.com>
53 lines
2.1 KiB
Diff
53 lines
2.1 KiB
Diff
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
|
|
index 4c24cae..2792083 100644
|
|
--- a/Configurations/unix-Makefile.tmpl
|
|
+++ b/Configurations/unix-Makefile.tmpl
|
|
@@ -338,7 +338,7 @@ bindir={- file_name_is_absolute($bindir)
|
|
? $bindir : '$(INSTALLTOP)/$(BINDIR)' -}
|
|
|
|
PKGCONFIGDIR=$(libdir)/pkgconfig
|
|
-CMAKECONFIGDIR=$(libdir)/cmake/OpenSSL
|
|
+CMAKECONFIGDIR=$(INSTALLTOP)/share/openssl
|
|
|
|
MANDIR=$(INSTALLTOP)/share/man
|
|
DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
|
|
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
|
|
index 894834c..d6d3c41 100644
|
|
--- a/Configurations/windows-makefile.tmpl
|
|
+++ b/Configurations/windows-makefile.tmpl
|
|
@@ -254,7 +254,7 @@ MODULESDIR=$(MODULESDIR_dev)$(MODULESDIR_dir)
|
|
libdir={- file_name_is_absolute($libdir)
|
|
? $libdir : '$(INSTALLTOP)\$(LIBDIR)' -}
|
|
|
|
-CMAKECONFIGDIR=$(libdir)\cmake\OpenSSL
|
|
+CMAKECONFIGDIR=$(INSTALLTOP)\share\openssl
|
|
|
|
##### User defined commands and flags ################################
|
|
|
|
diff --git a/exporters/cmake/OpenSSLConfig.cmake.in b/exporters/cmake/OpenSSLConfig.cmake.in
|
|
index 2d23219..3477e20 100644
|
|
--- a/exporters/cmake/OpenSSLConfig.cmake.in
|
|
+++ b/exporters/cmake/OpenSSLConfig.cmake.in
|
|
@@ -136,6 +136,14 @@ set(OPENSSL_APPLINK_SOURCE "${_ossl_prefix}/{- unixify($OpenSSL::safe::installda
|
|
{- output_on() if $disabled{uplink}; "" -}
|
|
set(OPENSSL_PROGRAM "${OPENSSL_RUNTIME_DIR}/{- platform->bin('openssl') -}")
|
|
|
|
+if(NOT Z_VCPKG_OPENSSL_USE_SINGLE_CONFIG)
|
|
+ # Prevent loop
|
|
+ set(Z_VCPKG_OPENSSL_USE_SINGLE_CONFIG "prevent-loop")
|
|
+ # Chainload vcpkg's module-based multi-config target setup
|
|
+ find_package(OpenSSL MODULE)
|
|
+ set(Z_VCPKG_OPENSSL_USE_SINGLE_CONFIG 0)
|
|
+else()
|
|
+ # Use official single-config target setup
|
|
# Set up the imported targets
|
|
if(_ossl_use_static_libs)
|
|
{- output_off() unless $no_static; "" -}
|
|
@@ -235,5 +243,6 @@ set_property(TARGET OpenSSL::applink PROPERTY
|
|
INTERFACE_SOURCES "${OPENSSL_APPLINK_SOURCE}")
|
|
{- output_on() if $disabled{uplink}; "" -}
|
|
|
|
+endif()
|
|
unset(_ossl_prefix)
|
|
unset(_ossl_use_static_libs)
|