-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
41 lines (29 loc) · 946 Bytes
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
cmake_minimum_required(VERSION 3.23.2)
project(HttpClient)
include(FetchContent)
function(add_headers VAR)
set(headers ${${VAR}})
foreach(header ${ARGN})
set(headers ${headers} include/${header})
endforeach()
set(${VAR} ${headers})
endfunction()
find_package(
OpenSSL
COMPONENTS SSL Crypto
REQUIRED)
find_package(spdlog QUIET)
if (NOT spdlog_FOUND)
FetchContent_Declare(
spdlog
GIT_REPOSITORY https://github.com/gabime/spdlog.git
GIT_TAG v1.12.0
)
FetchContent_MakeAvailable(spdlog)
endif()
add_headers(HEADERS HttpClient.hpp strutil.hpp Url.hpp)
add_library(${PROJECT_NAME} ${HEADERS} src/HttpClient.cpp src/Url.cpp README.md)
target_link_libraries(${PROJECT_NAME} OpenSSL::SSL OpenSSL::Crypto spdlog::spdlog)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wpedantic)
target_include_directories(${PROJECT_NAME} PUBLIC include src)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)