Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 37 additions & 51 deletions ports/cpr/001-cpr-config.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
diff --git a/cpr/CMakeLists.txt b/cpr/CMakeLists.txt
index a6db5bd..90bec48 100644
index 563b785..c02d41e 100644
--- a/cpr/CMakeLists.txt
+++ b/cpr/CMakeLists.txt
@@ -1,47 +1,46 @@
-message(STATUS "Using CURL_INCLUDE_DIRS: ${CURL_INCLUDE_DIRS}.")
-include_directories(
- ${CPR_INCLUDE_DIRS}
- ${CURL_INCLUDE_DIRS})
-
add_library(${CPR_LIBRARIES}
@@ -1,31 +1,53 @@
cmake_minimum_required(VERSION 3.15)

-add_library(cpr
- auth.cpp
- cookies.cpp
- cprtypes.cpp
- curlholder.cpp
- digest.cpp
- error.cpp
- multipart.cpp
- ntlm.cpp
- parameters.cpp
- payload.cpp
- proxies.cpp
- session.cpp
- timeout.cpp
- unix_socket.cpp
- util.cpp
- )
+add_library(${CPR_LIBRARIES}
+ auth.cpp
+ cookies.cpp
+ cprtypes.cpp
Expand All @@ -23,34 +37,29 @@ index a6db5bd..90bec48 100644
+ util.cpp
+ ssl_options.cpp
+)
+

-add_library(cpr::cpr ALIAS cpr)
+target_link_libraries( ${CPR_LIBRARIES}
+ PUBLIC ${CURL_LIBRARIES}
+)
+

-target_link_libraries(cpr PUBLIC CURL::libcurl) # todo should be private, but first dependencys in ssl_options need to be removed
+target_include_directories(${CPR_LIBRARIES}
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ $<INSTALL_INTERFACE:include>
+ PRIVATE
+ $<BUILD_INTERFACE:${CURL_INCLUDE_DIRS}>
+)
+

- # Source files
- auth.cpp
- cookies.cpp
- cprtypes.cpp
- digest.cpp
- error.cpp
- multipart.cpp
- parameters.cpp
- payload.cpp
- proxies.cpp
- session.cpp
- timeout.cpp
- util.cpp
- ssl_options.cpp
# Set version for shared libraries.
-set_target_properties(cpr
+set_target_properties(${CPR_LIBRARIES}
PROPERTIES
VERSION ${${PROJECT_NAME}_VERSION}
SOVERSION ${${PROJECT_NAME}_VERSION_MAJOR})

-install(TARGETS cpr)
+set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
+install(
+ TARGETS ${CPR_LIBRARIES}
Expand All @@ -59,36 +68,13 @@ index a6db5bd..90bec48 100644
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)

- # Header files (useful in IDEs)
- "${CPR_INCLUDE_DIRS}/cpr/api.h"
- "${CPR_INCLUDE_DIRS}/cpr/auth.h"
- "${CPR_INCLUDE_DIRS}/cpr/body.h"
- "${CPR_INCLUDE_DIRS}/cpr/cookies.h"
- "${CPR_INCLUDE_DIRS}/cpr/cpr.h"
- "${CPR_INCLUDE_DIRS}/cpr/cprtypes.h"
- "${CPR_INCLUDE_DIRS}/cpr/curlholder.h"
- "${CPR_INCLUDE_DIRS}/cpr/defines.h"
- "${CPR_INCLUDE_DIRS}/cpr/digest.h"
- "${CPR_INCLUDE_DIRS}/cpr/error.h"
- "${CPR_INCLUDE_DIRS}/cpr/max_redirects.h"
- "${CPR_INCLUDE_DIRS}/cpr/multipart.h"
- "${CPR_INCLUDE_DIRS}/cpr/parameters.h"
- "${CPR_INCLUDE_DIRS}/cpr/payload.h"
- "${CPR_INCLUDE_DIRS}/cpr/proxies.h"
- "${CPR_INCLUDE_DIRS}/cpr/response.h"
- "${CPR_INCLUDE_DIRS}/cpr/session.h"
- "${CPR_INCLUDE_DIRS}/cpr/timeout.h"
- "${CPR_INCLUDE_DIRS}/cpr/util.h"
- "${CPR_INCLUDE_DIRS}/cpr/ssl_options.h")
+
+install(
+ EXPORT ${TARGETS_EXPORT_NAME}
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
+)

-message(STATUS "Using CURL_LIBRARIES: ${CURL_LIBRARIES}.")
-target_link_libraries(${CPR_LIBRARIES}
- ${CURL_LIBRARIES})
+
+if (NOT DISABLE_INSTALL_HEADERS)
+ install(DIRECTORY ${CPR_INCLUDE_DIRS}/cpr DESTINATION include)
+endif()
\ No newline at end of file
12 changes: 7 additions & 5 deletions ports/cpr/002_cpr_fixcase.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
diff --git a/cpr/error.cpp b/cpr/error.cpp
index 713cb10..4143f93 100644
index 7228b58..860cf8d 100644
--- a/cpr/error.cpp
+++ b/cpr/error.cpp
@@ -38,8 +38,6 @@ ErrorCode Error::getErrorCodeForCurlError(std::int32_t curl_code) {
return ErrorCode::SSL_LOCAL_CERTIFICATE_ERROR;
case CURLE_SSL_CIPHER:
return ErrorCode::GENERIC_SSL_ERROR;
@@ -43,10 +43,6 @@ ErrorCode Error::getErrorCodeForCurlError(std::int32_t curl_code) {
#if LIBCURL_VERSION_NUM >= 0x073e00
case CURLE_PEER_FAILED_VERIFICATION:
return ErrorCode::SSL_REMOTE_CERTIFICATE_ERROR;
-#else
- case CURLE_SSL_CACERT:
- return ErrorCode::SSL_CACERT_ERROR;
-#endif
case CURLE_USE_SSL_FAILED:
return ErrorCode::GENERIC_SSL_ERROR;
case CURLE_SSL_ENGINE_INITFAILED:
2 changes: 1 addition & 1 deletion ports/cpr/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: cpr
Version: 1.3.0-8
Version: 1.5.1
Homepage: https://github.com/whoshuu/cpr
Description: C++ Requests is a simple wrapper around libcurl inspired by the excellent Python Requests project.
Build-Depends: curl[core]
30 changes: 30 additions & 0 deletions ports/cpr/fix-install-directory.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/cpr/CMakeLists.txt b/cpr/CMakeLists.txt
index edf77e6..aba4913 100644
--- a/cpr/CMakeLists.txt
+++ b/cpr/CMakeLists.txt
@@ -13,7 +13,6 @@ add_library(${CPR_LIBRARIES}
session.cpp
timeout.cpp
util.cpp
- ssl_options.cpp
)

target_link_libraries( ${CPR_LIBRARIES}
@@ -49,5 +48,5 @@ install(
)

if (NOT DISABLE_INSTALL_HEADERS)
- install(DIRECTORY ${CPR_INCLUDE_DIRS}/cpr DESTINATION include)
+ install(DIRECTORY DESTINATION include)
endif()
\ No newline at end of file
diff --git a/cpr/error.cpp b/cpr/error.cpp
index 860cf8d..7117f26 100644
--- a/cpr/error.cpp
+++ b/cpr/error.cpp
@@ -63,3 +63,4 @@ ErrorCode Error::getErrorCodeForCurlError(std::int32_t curl_code) {
}

} // namespace cpr
+#endif
\ No newline at end of file
12 changes: 5 additions & 7 deletions ports/cpr/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
include(vcpkg_common_functions)

vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO whoshuu/cpr
REF 1.3.0
SHA512 fd08f8a592a5e1fb8dc93158a4850b81575983c08527fb415f65bd9284f93c804c8680d16c548744583cd26b9353a7d4838269cfc59ccb6003da8941f620c273
REF 5e87cb5f45ac99858f0286dc1c35a6cd27c3bcb9 #v1.5.1
SHA512 1ea6295b5568d8d5d099cb1d89d19b3cae873bd869f64be4495be301561c91893f3c1c375823ce18419c780cda52aab79520293ff63ee529ded5431ec511ce5c
HEAD_REF master
PATCHES
001-cpr-config.patch
002_cpr_fixcase.patch
fix-install-directory.patch
)

vcpkg_configure_cmake(
Expand All @@ -25,13 +24,12 @@ vcpkg_configure_cmake(

vcpkg_install_cmake()

file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/cprConfig.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/lib/cmake/cpr)
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/cprConfig.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/lib/cmake/${PORT})
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/cpr)

vcpkg_copy_pdbs()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)

# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/cpr)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/cpr/LICENSE ${CURRENT_PACKAGES_DIR}/share/cpr/copyright)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)