Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xerces-c: hotfix - honor shared=False option #13616

Merged
merged 2 commits into from
Oct 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 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 All @@ -113,6 +110,8 @@ def generate(self):
env = VirtualBuildEnv(self)
env.generate()
tc = CMakeToolchain(self)
# Because upstream overrides BUILD_SHARED_LIBS as a CACHE variable
tc.cache_variables["BUILD_SHARED_LIBS"] = "ON" if self.options.shared else "OFF"
# https://xerces.apache.org/xerces-c/build-3.html
tc.variables["network-accessor"] = self.options.network_accessor
tc.variables["transcoder"] = self.options.transcoder
Expand Down Expand Up @@ -153,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"