Skip to content

Commit

Permalink
In the protobuf recipe, if we aren't in a version that supports the r…
Browse files Browse the repository at this point in the history
…emoval of RTTI, remove it

That also means there will be no CMake definition, and that Conan will
crash if you request it.
  • Loading branch information
floriansimon1 committed Mar 8, 2021
1 parent ec851e0 commit aa3ca2b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions recipes/protobuf/all/conanfile.py
Expand Up @@ -45,6 +45,10 @@ def _build_subfolder(self):
def _is_clang_x86(self):
return self.settings.compiler == "clang" and self.settings.arch == "x86"

@property
def _can_disable_rtti(self):
return tools.Version(self.version) >= "3.15.4"

def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_folder = self.name + "-" + self.version
Expand All @@ -53,12 +57,10 @@ def source(self):
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
if not self._can_disable_rtti:
del self.options.with_rtti

def configure(self):
if not self.options.with_rtti:
if tools.Version(self.version) < "3.15.4":
raise ConanInvalidConfiguration("Disabling RTTI is only possible for versions 3.15.4+")

if self.options.shared:
del self.options.fPIC

Expand Down Expand Up @@ -88,7 +90,8 @@ def _configure_cmake(self):
self._cmake.definitions["protobuf_BUILD_TESTS"] = False
self._cmake.definitions["protobuf_BUILD_PROTOC_BINARIES"] = True
self._cmake.definitions["protobuf_BUILD_LIBPROTOC"] = True
self._cmake.definitions["protobuf_DISABLE_RTTI"] = not self.options.with_rtti
if self._can_disable_rtti:
self._cmake.definitions["protobuf_DISABLE_RTTI"] = not self.options.with_rtti
if self.settings.compiler == "Visual Studio":
self._cmake.definitions["protobuf_MSVC_STATIC_RUNTIME"] = "MT" in str(self.settings.compiler.runtime)
self._cmake.configure(build_folder=self._build_subfolder)
Expand Down

0 comments on commit aa3ca2b

Please sign in to comment.