Skip to content

Commit

Permalink
(#4248) fix in CPR with WinSSL
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeterre authored and alazartech committed Jan 14, 2021
1 parent aab202a commit 7369a31
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions recipes/cpr/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,6 @@ def configure(self):
# self.options["libcurl"].with_winssl = True # deprecated in https://github.com/conan-io/conan-center-index/pull/2880
self.options["libcurl"].with_ssl = "schannel"

if self.options.get_safe("with_winssl", False) and self.settings.os != "Windows":
raise ConanInvalidConfiguration("cpr only supports winssl on Windows")

if self.options.get_safe("with_openssl", False) and self.options.get_safe("with_winssl", False):
raise ConanInvalidConfiguration("cpr can not be built with both openssl and winssl")

if self.settings.compiler == "Visual Studio" and self.options.shared and "MT" in self.settings.compiler.runtime:
raise ConanInvalidConfiguration("Visual Studio build for shared library with MT runtime is not supported")

def source(self):
tools.get(**self.conan_data["sources"][self.version])
os.rename("cpr-{}".format(self.version), self._source_subfolder)
Expand Down Expand Up @@ -107,12 +98,19 @@ def _configure_cmake(self):
self._cmake.configure(build_folder=self._build_subfolder)
return self._cmake

def build(self):
def validate(self):
if self.options.get_safe("with_winssl", False) and self.settings.os != "Windows":
raise ConanInvalidConfiguration("cpr only supports winssl on Windows")
if self.options.get_safe("with_openssl", False) and self.options.get_safe("with_winssl", False):
raise ConanInvalidConfiguration("cpr can not be built with both openssl and winssl")
if self.settings.compiler == "Visual Studio" and self.options.shared and "MT" in self.settings.compiler.runtime:
raise ConanInvalidConfiguration("Visual Studio build for shared library with MT runtime is not supported")
if self.options.get_safe("with_openssl", False) and self.options["libcurl"].with_ssl != "openssl":
raise ConanInvalidConfiguration("cpr requires libcurl to be built with the option with_ssl='openssl'.")
if self.options.get_safe("with_winssl", False) and self.options["libcurl"].with_ssl != "openssl":
if self.options.get_safe("with_winssl", False) and self.options["libcurl"].with_ssl != "schannel":
raise ConanInvalidConfiguration("cpr requires libcurl to be built with the option with_ssl='schannel'.")

def build(self):
self._patch_sources()
cmake = self._configure_cmake()
cmake.build()
Expand Down

0 comments on commit 7369a31

Please sign in to comment.