From 2a0ae8521caa350b2790bab52ab82d39e2d390ed Mon Sep 17 00:00:00 2001 From: Sophie Lawrence Date: Thu, 29 Aug 2024 12:03:03 -0400 Subject: [PATCH] (#25070) jwt-cpp: Fix missing picojson header --- recipes/jwt-cpp/all/conanfile.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/recipes/jwt-cpp/all/conanfile.py b/recipes/jwt-cpp/all/conanfile.py index 1e09b3d6625c7d..2d828fd2a9fd6a 100644 --- a/recipes/jwt-cpp/all/conanfile.py +++ b/recipes/jwt-cpp/all/conanfile.py @@ -16,9 +16,12 @@ class JwtCppConan(ConanFile): package_type = "header-library" settings = "os", "arch", "compiler", "build_type" + options = { "enable_picojson": [True, False] } + default_options = { "enable_picojson" : False } + @property - def _supports_generic_json(self): - return Version(self.version) >= "0.5.0" + def _enable_picojson(self): + return Version(self.version) < "0.5.0" or self.options.enable_picojson def export_sources(self): export_conandata_patches(self) @@ -28,7 +31,7 @@ def layout(self): def requirements(self): self.requires("openssl/[>=1.1 <4]") - if not self._supports_generic_json: + if self._enable_picojson: self.requires("picojson/1.3.0") def package_id(self): @@ -48,9 +51,10 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] self.cpp_info.libdirs = [] - + if self._enable_picojson: + self.cpp_info.requires = ["picojson::picojson"] + else: + self.cpp_info.defines.append("JWT_DISABLE_PICOJSON") self.cpp_info.set_property("cmake_file_name", "jwt-cpp") self.cpp_info.set_property("cmake_target_name", "jwt-cpp::jwt-cpp") - if self._supports_generic_json: - self.cpp_info.defines.append("JWT_DISABLE_PICOJSON")