From ca61e9d8ca344c80b8904cfd0913716485408e9a Mon Sep 17 00:00:00 2001 From: Guillaume Egles Date: Thu, 28 Mar 2024 17:40:29 -0700 Subject: [PATCH] openssl: make things a bit more generic This removes some hardcoded names and allows for the package to be "renamed" more easily... For example if one wanted to create a distinct `openssl-fips` package so as to use it in conjunction with the standard `openssl` package without any collision. See https://github.com/conan-io/conan-center-index/issues/22796 for more context --- recipes/openssl/3.x.x/conanfile.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/recipes/openssl/3.x.x/conanfile.py b/recipes/openssl/3.x.x/conanfile.py index f1a5c603e6eeb6..088dc704c2d830 100644 --- a/recipes/openssl/3.x.x/conanfile.py +++ b/recipes/openssl/3.x.x/conanfile.py @@ -590,12 +590,12 @@ def _create_cmake_module_variables(self, module_file): ${OpenSSL_Crypto_DEPENDENCIES} ${OpenSSL_Crypto_FRAMEWORKS} ${OpenSSL_Crypto_SYSTEM_LIBS}) - elseif(DEFINED openssl_OpenSSL_Crypto_LIBS_%(config)s) - set(OPENSSL_CRYPTO_LIBRARY ${openssl_OpenSSL_Crypto_LIBS_%(config)s}) - set(OPENSSL_CRYPTO_LIBRARIES ${openssl_OpenSSL_Crypto_LIBS_%(config)s} - ${openssl_OpenSSL_Crypto_DEPENDENCIES_%(config)s} - ${openssl_OpenSSL_Crypto_FRAMEWORKS_%(config)s} - ${openssl_OpenSSL_Crypto_SYSTEM_LIBS_%(config)s}) + elseif(DEFINED %(package_name)s_OpenSSL_Crypto_LIBS_%(config)s) + set(OPENSSL_CRYPTO_LIBRARY ${%(package_name)s_OpenSSL_Crypto_LIBS_%(config)s}) + set(OPENSSL_CRYPTO_LIBRARIES ${%(package_name)s_OpenSSL_Crypto_LIBS_%(config)s} + ${%(package_name)s_OpenSSL_Crypto_DEPENDENCIES_%(config)s} + ${%(package_name)s_OpenSSL_Crypto_FRAMEWORKS_%(config)s} + ${%(package_name)s_OpenSSL_Crypto_SYSTEM_LIBS_%(config)s}) endif() if(DEFINED OpenSSL_SSL_LIBS) set(OPENSSL_SSL_LIBRARY ${OpenSSL_SSL_LIBS}) @@ -603,12 +603,12 @@ def _create_cmake_module_variables(self, module_file): ${OpenSSL_SSL_DEPENDENCIES} ${OpenSSL_SSL_FRAMEWORKS} ${OpenSSL_SSL_SYSTEM_LIBS}) - elseif(DEFINED openssl_OpenSSL_SSL_LIBS_%(config)s) - set(OPENSSL_SSL_LIBRARY ${openssl_OpenSSL_SSL_LIBS_%(config)s}) - set(OPENSSL_SSL_LIBRARIES ${openssl_OpenSSL_SSL_LIBS_%(config)s} - ${openssl_OpenSSL_SSL_DEPENDENCIES_%(config)s} - ${openssl_OpenSSL_SSL_FRAMEWORKS_%(config)s} - ${openssl_OpenSSL_SSL_SYSTEM_LIBS_%(config)s}) + elseif(DEFINED %(package_name)s_OpenSSL_SSL_LIBS_%(config)s) + set(OPENSSL_SSL_LIBRARY ${%(package_name)s_OpenSSL_SSL_LIBS_%(config)s}) + set(OPENSSL_SSL_LIBRARIES ${%(package_name)s_OpenSSL_SSL_LIBS_%(config)s} + ${%(package_name)s_OpenSSL_SSL_DEPENDENCIES_%(config)s} + ${%(package_name)s_OpenSSL_SSL_FRAMEWORKS_%(config)s} + ${%(package_name)s_OpenSSL_SSL_SYSTEM_LIBS_%(config)s}) endif() if(DEFINED OpenSSL_LIBRARIES) set(OPENSSL_LIBRARIES ${OpenSSL_LIBRARIES}) @@ -616,7 +616,7 @@ def _create_cmake_module_variables(self, module_file): if(DEFINED OpenSSL_VERSION) set(OPENSSL_VERSION ${OpenSSL_VERSION}) endif() - """% {"config":str(self.settings.build_type).upper()}) + """% {"config":str(self.settings.build_type).upper(), "package_name":self.name}) save(self, module_file, content) @property @@ -631,6 +631,7 @@ def _module_file_rel_path(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "OpenSSL") self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_target_name", "openssl::openssl") self.cpp_info.set_property("pkg_config_name", "openssl") self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path]) self.cpp_info.names["cmake_find_package"] = "OpenSSL"