mirror of
https://github.com/BlackMATov/curly.hpp.git
synced 2025-12-13 03:29:37 +07:00
add embedded curl
This commit is contained in:
@@ -20,14 +20,13 @@ matrix:
|
||||
- os: osx
|
||||
osx_image: xcode10
|
||||
compiler: clang
|
||||
addons: { homebrew: { packages: ["lcov"] } }
|
||||
after_success: ./scripts/upload_coverage.sh
|
||||
before_install:
|
||||
- eval "${MATRIX_EVAL}"
|
||||
- if [ "$TRAVIS_OS_NAME" == 'osx' ]; then
|
||||
brew update;
|
||||
brew upgrade cmake;
|
||||
brew install git-lfs;
|
||||
brew install lcov git-lfs;
|
||||
fi
|
||||
- if [ "$TRAVIS_OS_NAME" == 'linux' ]; then
|
||||
mkdir $HOME/cmake;
|
||||
|
||||
@@ -7,7 +7,11 @@ endif()
|
||||
|
||||
project(curly.hpp)
|
||||
|
||||
option(CURLY_USE_SYSTEM_CURL "Link with cURL from system paths" ON)
|
||||
option(CURLY_USE_SYSTEM_CURL "Build with cURL from system paths" OFF)
|
||||
option(CURLY_USE_EMBEDDED_CURL "Build with embedded cURL library" ON)
|
||||
|
||||
# set(CURLY_USE_SYSTEM_CURL ON CACHE BOOL "" FORCE)
|
||||
# set(CURLY_USE_EMBEDDED_CURL ON CACHE BOOL "" FORCE)
|
||||
|
||||
add_library(${PROJECT_NAME} STATIC
|
||||
headers/curly.hpp/curly.hpp
|
||||
@@ -36,6 +40,46 @@ if(CURLY_USE_SYSTEM_CURL)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${CURL_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
if(CURLY_USE_EMBEDDED_CURL)
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
embedded_curl
|
||||
GIT_REPOSITORY https://github.com/curl/curl
|
||||
GIT_TAG curl-7_65_1)
|
||||
|
||||
FetchContent_GetProperties(embedded_curl)
|
||||
if(NOT embedded_curl_POPULATED)
|
||||
FetchContent_Populate(embedded_curl)
|
||||
endif()
|
||||
|
||||
set(HTTP_ONLY ON CACHE BOOL "" FORCE)
|
||||
set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
|
||||
set(BUILD_CURL_EXE OFF CACHE BOOL "" FORCE)
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
||||
|
||||
if(WIN32)
|
||||
set(CMAKE_USE_WINSSL ON CACHE BOOL "" FORCE)
|
||||
set(CURL_CA_PATH "none" CACHE STRING "" FORCE)
|
||||
set(CURL_CA_BUNDLE "none" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_USE_SECTRANSP ON CACHE BOOL "" FORCE)
|
||||
set(CURL_CA_PATH "none" CACHE STRING "" FORCE)
|
||||
set(CURL_CA_BUNDLE "none" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(CMAKE_USE_OPENSSL ON CACHE BOOL "" FORCE)
|
||||
set(CURL_CA_PATH "auto" CACHE STRING "" FORCE)
|
||||
set(CURL_CA_BUNDLE "auto" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
add_subdirectory(${embedded_curl_SOURCE_DIR} ${embedded_curl_BINARY_DIR})
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC libcurl)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${CURL_SOURCE_DIR}/include)
|
||||
endif()
|
||||
|
||||
if(BUILD_AS_STANDALONE)
|
||||
option(BUILD_WITH_UNTESTS "Build with unit tests" ON)
|
||||
if(BUILD_WITH_UNTESTS)
|
||||
|
||||
@@ -15,6 +15,14 @@
|
||||
#include <functional>
|
||||
#include <condition_variable>
|
||||
|
||||
#ifndef NOMINMAX
|
||||
# define NOMINMAX
|
||||
#endif
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -3,8 +3,6 @@ cmake_minimum_required(VERSION 3.11 FATAL_ERROR)
|
||||
|
||||
project(curly.hpp.untests)
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
#
|
||||
# coverage
|
||||
#
|
||||
@@ -39,6 +37,7 @@ add_test(${PROJECT_NAME} ${PROJECT_NAME})
|
||||
# catchorg/catch2
|
||||
#
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
catchorg_catch2
|
||||
GIT_REPOSITORY https://github.com/catchorg/catch2)
|
||||
@@ -54,6 +53,7 @@ endif()
|
||||
# tencent/rapidjson
|
||||
#
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
tencent_rapidjson
|
||||
GIT_REPOSITORY https://github.com/tencent/rapidjson)
|
||||
|
||||
Reference in New Issue
Block a user