Skip to content

Commit

Permalink
protobuf: add check for shared abseil
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Jan 17, 2024
1 parent 7bb3e3f commit a0ba6ea
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions recipes/protobuf/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def config_options(self):
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
# shared build protobuf requires Abseil as shared libraries to avoid ODR violations.
if Version(self.version) >= "3.22.0" and is_msvc(self):
self.options["abseil"].shared = True

Expand All @@ -95,15 +94,17 @@ def requirements(self):
def validate(self):
if self.settings.compiler.cppstd:
check_min_cppstd(self, self._min_cppstd)

minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.",
)

if self.options.shared and is_msvc_static_runtime(self):
raise ConanInvalidConfiguration(f"{self.ref} can't be built with shared + MT(d) runtimes")
if self.options.shared and is_msvc(self):
if is_msvc_static_runtime(self):
raise ConanInvalidConfiguration(f"{self.ref} can't be built with shared + MT(d) runtimes")
if Version(self.version) >= "3.22.0" and not self.dependencies["abseil"].options.shared:
raise ConanInvalidConfiguration(f"Shared build of protobuf requires shared Abseil on MSVC to avoid ODR violations.")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
Expand Down

0 comments on commit a0ba6ea

Please sign in to comment.