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

- [protobuf] fix clang-cl #10005

Merged
merged 2 commits into from
Apr 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 12 additions & 3 deletions recipes/protobuf/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def _build_subfolder(self):
def _is_msvc(self):
return str(self.settings.compiler) in ["Visual Studio", "msvc"]

@property
def _is_clang_cl(self):
return self.settings.compiler == 'clang' and self.settings.os == 'Windows'

@property
def _is_clang_x86(self):
return self.settings.compiler == "clang" and self.settings.arch == "x86"
Expand Down Expand Up @@ -112,8 +116,13 @@ def _configure_cmake(self):
cmake.definitions["protobuf_BUILD_LIBPROTOC"] = True
if self._can_disable_rtti:
cmake.definitions["protobuf_DISABLE_RTTI"] = not self.options.with_rtti
if self._is_msvc:
cmake.definitions["protobuf_MSVC_STATIC_RUNTIME"] = "MT" in msvc_runtime_flag(self)
if self._is_msvc or self._is_clang_cl:
runtime = msvc_runtime_flag(self)
if not runtime:
runtime = self.settings.get_safe("compiler.runtime")
cmake.definitions["protobuf_MSVC_STATIC_RUNTIME"] = "MT" in runtime
if tools.Version(self.version) < "3.18.0" and self._is_clang_cl:
cmake.definitions["CMAKE_RC_COMPILER"] = os.environ.get("RC", "llvm-rc")
cmake.configure(build_folder=self._build_subfolder)
return cmake

Expand Down Expand Up @@ -220,7 +229,7 @@ def package_info(self):
]
self.cpp_info.set_property("cmake_build_modules", build_modules)

lib_prefix = "lib" if self._is_msvc else ""
lib_prefix = "lib" if (self._is_msvc or self._is_clang_cl) else ""
lib_suffix = "d" if self.settings.build_type == "Debug" else ""

# libprotobuf
Expand Down