Skip to content

Commit

Permalink
(#25070) jwt-cpp: Fix missing picojson header
Browse files Browse the repository at this point in the history
  • Loading branch information
sophieeihpos committed Aug 29, 2024
1 parent 7266d08 commit 2a0ae85
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions recipes/jwt-cpp/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand All @@ -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")

0 comments on commit 2a0ae85

Please sign in to comment.