|
@@ -2,7 +2,6 @@ cmake_minimum_required (VERSION 3.13)
|
|
|
|
|
|
### Basic compilation settings
|
|
|
set (CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
|
|
-add_definitions (-DNOMINMAX)
|
|
|
|
|
|
include_directories (
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
@@ -10,10 +9,7 @@ include_directories (
|
|
|
)
|
|
|
|
|
|
### Compiler-specific flags
|
|
|
-if (MSVC)
|
|
|
- set (DLLEXPORT "__declspec(dllexport)")
|
|
|
-elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
|
|
- set (DLLEXPORT "__attribute__((visibility(\"default\")))")
|
|
|
+if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
|
|
add_compile_options ("-fvisibility=hidden")
|
|
|
add_link_options ("-fvisibility=hidden")
|
|
|
endif ()
|
|
@@ -24,6 +20,7 @@ add_library (https MODULE
|
|
|
)
|
|
|
|
|
|
add_library (https-common STATIC
|
|
|
+ common/HTTPS.cpp
|
|
|
common/HTTPRequest.cpp
|
|
|
common/HTTPSClient.cpp
|
|
|
common/PlaintextConnection.cpp
|
|
@@ -42,7 +39,7 @@ add_library (https-schannel STATIC EXCLUDE_FROM_ALL
|
|
|
)
|
|
|
|
|
|
add_library (https-nsurl STATIC EXCLUDE_FROM_ALL
|
|
|
- macos/NSURLClient.mm
|
|
|
+ apple/NSURLClient.mm
|
|
|
)
|
|
|
|
|
|
add_library (https-android STATIC EXCLUDE_FROM_ALL
|
|
@@ -54,7 +51,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
|
option (USE_CURL_BACKEND "Use the libcurl backend" ON)
|
|
|
option (USE_OPENSSL_BACKEND "Use the openssl backend" ON)
|
|
|
option (USE_SCHANNEL_BACKEND "Use the schannel backend (windows-only)" OFF)
|
|
|
- option (USE_NSURL_BACKEND "Use the NSUrl backend (macos-only)" OFF)
|
|
|
+ option (USE_NSURL_BACKEND "Use the NSUrl backend (apple-only)" OFF)
|
|
|
option (USE_ANDROID_BACKEND "Use the Android Java backend (Android-only)" OFF)
|
|
|
|
|
|
option (USE_WINSOCK "Use winsock instead of BSD sockets (windows-only)" OFF)
|
|
@@ -62,7 +59,7 @@ elseif (WIN32)
|
|
|
option (USE_CURL_BACKEND "Use the libcurl backend" OFF)
|
|
|
option (USE_OPENSSL_BACKEND "Use the openssl backend" OFF)
|
|
|
option (USE_SCHANNEL_BACKEND "Use the schannel backend (windows-only)" ON)
|
|
|
- option (USE_NSURL_BACKEND "Use the NSUrl backend (macos-only)" OFF)
|
|
|
+ option (USE_NSURL_BACKEND "Use the NSUrl backend (apple-only)" OFF)
|
|
|
option (USE_ANDROID_BACKEND "Use the Android Java backend (Android-only)" OFF)
|
|
|
|
|
|
option (USE_WINSOCK "Use winsock instead of BSD sockets (windows-only)" ON)
|
|
@@ -70,7 +67,7 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
|
|
option (USE_CURL_BACKEND "Use the libcurl backend" OFF)
|
|
|
option (USE_OPENSSL_BACKEND "Use the openssl backend" OFF)
|
|
|
option (USE_SCHANNEL_BACKEND "Use the schannel backend (windows-only)" OFF)
|
|
|
- option (USE_NSURL_BACKEND "Use the NSUrl backend (macos-only)" ON)
|
|
|
+ option (USE_NSURL_BACKEND "Use the NSUrl backend (apple-only)" ON)
|
|
|
option (USE_ANDROID_BACKEND "Use the Android Java backend (Android-only)" OFF)
|
|
|
|
|
|
option (USE_WINSOCK "Use winsock instead of BSD sockets (windows-only)" OFF)
|
|
@@ -78,7 +75,7 @@ elseif (ANDROID)
|
|
|
option (USE_CURL_BACKEND "Use the libcurl backend" OFF)
|
|
|
option (USE_OPENSSL_BACKEND "Use the openssl backend" OFF)
|
|
|
option (USE_SCHANNEL_BACKEND "Use the schannel backend (windows-only)" OFF)
|
|
|
- option (USE_NSURL_BACKEND "Use the NSUrl backend (macos-only)" OFF)
|
|
|
+ option (USE_NSURL_BACKEND "Use the NSUrl backend (apple-only)" OFF)
|
|
|
option (USE_ANDROID_BACKEND "Use the Android Java backend (Android-only)" ON)
|
|
|
|
|
|
option (USE_WINSOCK "Use winsock instead of BSD sockets (windows-only)" OFF)
|
|
@@ -95,22 +92,26 @@ include_directories (${LUA_INCLUDE_DIR})
|
|
|
target_link_libraries (https ${LUA_LIBRARIES})
|
|
|
|
|
|
if (USE_CURL_BACKEND)
|
|
|
+ set(HTTPS_BACKEND_CURL ON)
|
|
|
find_package (CURL REQUIRED)
|
|
|
include_directories (${CURL_INCLUDE_DIR})
|
|
|
target_link_libraries (https https-curl ${CURL_LIBRARIES})
|
|
|
endif ()
|
|
|
|
|
|
if (USE_OPENSSL_BACKEND)
|
|
|
+ set(HTTPS_BACKEND_OPENSSL ON)
|
|
|
find_package (OpenSSL REQUIRED)
|
|
|
include_directories (${OPENSSL_INCLUDE_DIR})
|
|
|
target_link_libraries (https https-openssl ${OPENSSL_LIBRARIES})
|
|
|
endif ()
|
|
|
|
|
|
if (USE_SCHANNEL_BACKEND)
|
|
|
+ set(HTTPS_BACKEND_SCHANNEL ON)
|
|
|
target_link_libraries (https https-schannel ws2_32 secur32)
|
|
|
endif ()
|
|
|
|
|
|
if (USE_NSURL_BACKEND)
|
|
|
+ set(HTTPS_BACKEND_NSURL ON)
|
|
|
set_target_properties(
|
|
|
https-nsurl
|
|
|
PROPERTIES
|
|
@@ -122,12 +123,18 @@ if (USE_NSURL_BACKEND)
|
|
|
endif ()
|
|
|
|
|
|
if (USE_ANDROID_BACKEND)
|
|
|
+ set(HTTPS_BACKEND_ANDROID ON)
|
|
|
target_link_libraries (https https-android)
|
|
|
message(STATUS "Ensure to add the Java files to your project too!")
|
|
|
endif ()
|
|
|
|
|
|
-### Generate config.h
|
|
|
+if (USE_WINSOCK)
|
|
|
+ set(HTTPS_USE_WINSOCK ON)
|
|
|
+endif ()
|
|
|
+
|
|
|
+### Generate config-generated.h
|
|
|
+add_compile_definitions(HTTPS_HAVE_CONFIG_GENERATED_H)
|
|
|
configure_file (
|
|
|
- common/config.h.in
|
|
|
- common/config.h
|
|
|
+ common/config-generated.h.in
|
|
|
+ common/config-generated.h
|
|
|
)
|