Skip to content

Commit

Permalink
mbedtls: propagate snprintf macro in package_info, only for current v…
Browse files Browse the repository at this point in the history
…ersions (#26299)
  • Loading branch information
jcar87 authored Jan 3, 2025
1 parent 3a61044 commit f1c8bc1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions recipes/mbedtls/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,8 @@ def generate(self):
if Version(self.version) < "3.0.0":
# relocatable shared libs on macOS
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW"
if is_msvc(self):
if check_min_vs(self, 190, raise_invalid=False):
tc.preprocessor_definitions["MBEDTLS_PLATFORM_SNPRINTF_MACRO"] = "snprintf"
else:
tc.preprocessor_definitions["MBEDTLS_PLATFORM_SNPRINTF_MACRO"] = "MBEDTLS_PLATFORM_STD_SNPRINTF"
if is_msvc(self) and "2.16.12" <= Version(self.version) <= "3.6.0":
tc.preprocessor_definitions["MBEDTLS_PLATFORM_SNPRINTF_MACRO"] = "snprintf"
if self.options.enable_threading:
tc.preprocessor_definitions["MBEDTLS_THREADING_C"] = True
tc.preprocessor_definitions["MBEDTLS_THREADING_PTHREAD"] = True
Expand Down Expand Up @@ -139,6 +136,11 @@ def package_info(self):
self.cpp_info.components["libembedtls"].set_property("cmake_target_name", "MbedTLS::mbedtls")
self.cpp_info.components["libembedtls"].libs = ["mbedtls"]
self.cpp_info.components["libembedtls"].requires = ["mbedx509"]

if is_msvc(self) and "2.16.12" <= Version(self.version) <= "3.6.0":
for component in ["mbedcrypto", "libembedtls", "mbedx509"]:
self.cpp_info.components[component].defines.append("MBEDTLS_PLATFORM_SNPRINTF_MACRO=snprintf")

if Version(self.version) >= "3.6.0":
self.cpp_info.components["libembedtls"].set_property("pkg_config_name", "embedtls")

Expand Down

0 comments on commit f1c8bc1

Please sign in to comment.