Skip to content

Commit

Permalink
(#3727) Update cpr
Browse files Browse the repository at this point in the history
* Theoretically add cpr 1.5.2

* Merge in attempts from #3207

* Doesn't exist there
  • Loading branch information
LunarWatcher committed Dec 3, 2020
1 parent 839c917 commit e725f03
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
6 changes: 6 additions & 0 deletions recipes/cpr/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ sources:
"1.5.0":
sha256: "a1727794541bac6d1bb73c9c27ac3ef5b0d64edcc4f81dc8d79b3cf31b6144e9"
url: https://github.com/whoshuu/cpr/archive/1.5.0.tar.gz
"1.5.2":
sha256: "6fc9102dd63b549912d7af1ec95ee41ece1a2fe27f759864306b07f6fcf24fe1"
url: https://github.com/whoshuu/cpr/archive/1.5.2.tar.gz
patches:
"1.3.0":
- patch_file: "patches/001-fix-curl-define.patch"
Expand All @@ -30,3 +33,6 @@ patches:
base_path: "source_subfolder"
- patch_file: "patches/002-1.5.0-not_search_for_openssl.patch"
base_path: "source_subfolder"
"1.5.2":
- patch_file: "patches/001-1.5.2-curl-global-scope.patch"
base_path: "source_subfolder"
5 changes: 2 additions & 3 deletions recipes/cpr/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ def config_options(self):
def configure(self):
if self.options.shared:
del self.options.fPIC
if self.options.with_openssl:
# If using OpenSSL, we need it to be active in libcurl too
self.options["libcurl"].with_openssl = True

def source(self):
tools.get(**self.conan_data["sources"][self.version])
Expand Down Expand Up @@ -67,6 +64,8 @@ def _configure_cmake(self):
return cmake

def build(self):
if self.options.with_openssl and self.options["libcurl"].with_ssl != "openssl":
raise ConanInvalidConfiguration("cpr requires libcurl to be built with the option with_ssl=\"openssl\".")
self._patch_sources()
cmake = self._configure_cmake()
cmake.build()
Expand Down
27 changes: 27 additions & 0 deletions recipes/cpr/all/patches/001-1.5.2-curl-global-scope.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c065227..3ed93b8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,7 +55,7 @@ include(cmake/code_coverage.cmake)

# Curl configuration
if(USE_SYSTEM_CURL)
- find_package(CURL COMPONENTS PROTOCOLS HTTP HTTPS FEATURES SSL)
+ find_package(CURL)
if (CURL_FOUND)
set(SSL_ENABLED ON CACHE INTERNAL "" FORCE)
else()
diff --git a/cpr/CMakeLists.txt b/cpr/CMakeLists.txt
index 563b785..a7ccbdf 100644
--- a/cpr/CMakeLists.txt
+++ b/cpr/CMakeLists.txt
@@ -20,7 +20,8 @@ add_library(cpr

add_library(cpr::cpr ALIAS cpr)

-target_link_libraries(cpr PUBLIC CURL::libcurl) # todo should be private, but first dependencys in ssl_options need to be removed
+target_link_libraries(cpr PUBLIC ${CURL_LIBRARIES}) # todo should be private, but first dependencys in ssl_options need to be removed
+target_include_directories(cpr PUBLIC ${CURL_INCLUDE_DIRS})

# Set version for shared libraries.
set_target_properties(cpr
2 changes: 2 additions & 0 deletions recipes/cpr/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ versions:
folder: all
"1.5.0":
folder: all
"1.5.2":
folder: all

0 comments on commit e725f03

Please sign in to comment.