Skip to content

Commit

Permalink
improve conan v2 client support
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceIm committed Oct 19, 2022
1 parent 376d312 commit 4cb7440
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions recipes/xerces-c/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from conan import ConanFile
from conan import ConanFile, conan_version
from conan.errors import ConanInvalidConfiguration
from conan.tools.env import VirtualBuildEnv
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir
from conan.tools.scm import Version
import os

required_conan_version = ">=1.52.0"
Expand Down Expand Up @@ -82,11 +83,7 @@ def _validate(self, option, value, os):
OS(es) that `value` is valid on
"""
if self.info.settings.os not in os and getattr(self.info.options, option) == value:
raise ConanInvalidConfiguration(
"Option '{option}={value}' is only supported on {os}".format(
option=option, value=value, os=os
)
)
raise ConanInvalidConfiguration(f"Option '{option}={value}' is only supported on {os}")

def validate(self):
if self.info.settings.os not in ("Windows", "Macos", "Linux"):
Expand Down Expand Up @@ -155,5 +152,6 @@ def package_info(self):
elif self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.append("pthread")

self.cpp_info.names["cmake_find_package"] = "XercesC"
self.cpp_info.names["cmake_find_package_multi"] = "XercesC"
if Version(conan_version).major < 2:
self.cpp_info.names["cmake_find_package"] = "XercesC"
self.cpp_info.names["cmake_find_package_multi"] = "XercesC"

0 comments on commit 4cb7440

Please sign in to comment.