-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
curl: build a static library (#2004)
Since there's only one user: zsync2.
- Loading branch information
1 parent
808ec81
commit 25bb095
Showing
6 changed files
with
94 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -378,6 +378,7 @@ | ||
if(WIN32) | ||
set(USE_THREADS_WIN32 ON) | ||
else() | ||
+ set(THREADS_PREFER_PTHREAD_FLAG TRUE) | ||
find_package(Threads REQUIRED) | ||
set(USE_THREADS_POSIX ${CMAKE_USE_PTHREADS_INIT}) | ||
set(HAVE_PTHREAD_H ${CMAKE_USE_PTHREADS_INIT}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- i/lib/cpr/CMakeLists.txt | ||
+++ w/lib/cpr/CMakeLists.txt | ||
@@ -147,13 +147,10 @@ if(CPR_ENABLE_SSL) | ||
endif() | ||
else() | ||
if(CPR_FORCE_OPENSSL_BACKEND) | ||
- find_package(OpenSSL) | ||
- if(OPENSSL_FOUND) | ||
- message(STATUS "Using OpenSSL.") | ||
- set(SSL_BACKEND_USED "OpenSSL") | ||
- else() | ||
- message(FATAL_ERROR "CPR_FORCE_OPENSSL_BACKEND enabled but we were not able to find OpenSSL!") | ||
- endif() | ||
+ find_package(PkgConfig REQUIRED) | ||
+ pkg_check_modules(OpenSSL openssl REQUIRED IMPORTED_TARGET) | ||
+ message(STATUS "Using OpenSSL.") | ||
+ set(SSL_BACKEND_USED "OpenSSL") | ||
elseif(CPR_FORCE_WINSSL_BACKEND) | ||
message(STATUS "Using WinSSL.") | ||
set(SSL_BACKEND_USED "WinSSL") | ||
@@ -170,37 +167,13 @@ if(CPR_ENABLE_SSL) | ||
endif() | ||
|
||
if(SSL_BACKEND_USED STREQUAL "OpenSSL") | ||
-# Fix missing OpenSSL includes for Windows since in 'ssl_ctx.cpp' we include OpenSSL directly | ||
-find_package(OpenSSL REQUIRED) | ||
add_compile_definitions(OPENSSL_BACKEND_USED) | ||
endif() | ||
|
||
# Curl configuration | ||
if(CPR_USE_SYSTEM_CURL) | ||
- if(CPR_ENABLE_SSL) | ||
- find_package(CURL COMPONENTS HTTP HTTPS) | ||
- if(CURL_FOUND) | ||
- message(STATUS "Curl ${CURL_VERSION_STRING} found on this system.") | ||
- # To be able to load certificates under Windows when using OpenSSL: | ||
- if(CMAKE_USE_OPENSSL AND WIN32 AND (NOT (CURL_VERSION_STRING VERSION_GREATER_EQUAL "7.71.0"))) | ||
- message(FATAL_ERROR "Your system curl version (${CURL_VERSION_STRING}) is too old to support OpenSSL on Windows which requires curl >= 7.71.0. Update your curl version, use WinSSL, disable SSL or use the built-in version of curl.") | ||
- endif() | ||
- else() | ||
- find_package(CURL COMPONENTS HTTP) | ||
- if(CURL_FOUND) | ||
- message(FATAL_ERROR "Curl found on this system but WITHOUT HTTPS/SSL support. Either disable SSL by setting CPR_ENABLE_SSL to OFF or use the built-in version of curl by setting CPR_USE_SYSTEM_CURL to OFF.") | ||
- else() | ||
- message(FATAL_ERROR "Curl not found on this system. To use the built-in version set CPR_USE_SYSTEM_CURL to OFF.") | ||
- endif() | ||
- endif() | ||
- else() | ||
- find_package(CURL COMPONENTS HTTP) | ||
- if(CURL_FOUND) | ||
- message(STATUS "Curl found on this system.") | ||
- else() | ||
- message(FATAL_ERROR "Curl not found on this system. To use the built-in version set CPR_USE_SYSTEM_CURL to OFF.") | ||
- endif() | ||
- endif() | ||
+ find_package(PkgConfig REQUIRED) | ||
+ pkg_check_modules(CURL libcurl REQUIRED IMPORTED_TARGET) | ||
else() | ||
message(STATUS "Configuring built-in curl...") | ||
|
||
--- i/lib/cpr/cpr/CMakeLists.txt | ||
+++ w/lib/cpr/cpr/CMakeLists.txt | ||
@@ -32,12 +32,11 @@ add_library(cpr | ||
|
||
add_library(cpr::cpr ALIAS cpr) | ||
|
||
-target_link_libraries(cpr PUBLIC CURL::libcurl) # todo should be private, but first dependencies in ssl_options need to be removed | ||
+target_link_libraries(cpr PUBLIC PkgConfig::CURL) # todo should be private, but first dependencies in ssl_options need to be removed | ||
|
||
# Fix missing OpenSSL includes for Windows since in 'ssl_ctx.cpp' we include OpenSSL directly | ||
if(SSL_BACKEND_USED STREQUAL "OpenSSL") | ||
- target_link_libraries(cpr PRIVATE OpenSSL::SSL) | ||
- target_include_directories(cpr PRIVATE ${OPENSSL_INCLUDE_DIR}) | ||
+ target_link_libraries(cpr PRIVATE PkgConfig::OpenSSL) | ||
endif() | ||
|
||
# Set version for shared libraries. |
This file was deleted.
Oops, something went wrong.