Skip to content

Commit

Permalink
openssl: make things a bit more generic
Browse files Browse the repository at this point in the history
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 conan-io#22796 for more context
  • Loading branch information
gegles committed Mar 29, 2024
1 parent c7c6e63 commit 25be4f5
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions recipes/openssl/3.x.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,33 +590,33 @@ 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})
set(OPENSSL_SSL_LIBRARIES ${OpenSSL_SSL_LIBS}
${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})
endif()
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
Expand All @@ -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"
Expand Down

0 comments on commit 25be4f5

Please sign in to comment.