forked from lpcvoid/cpp-net-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
55 lines (46 loc) · 1.32 KB
/
CMakeLists.txt
File metadata and controls
55 lines (46 loc) · 1.32 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
cmake_minimum_required(VERSION 3.15)
project(netlib)
set(CMAKE_CXX_STANDARD 20)
# we want the maximum amount of compiler bickering
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()
find_package(Threads)
set(NETLIB_SRC
src/netlib.hpp
src/socket.hpp
src/client.hpp
src/server.hpp
src/service_resolver.hpp
src/endpoint_accessor.hpp
src/thread_pool.hpp
src/socket_operations.hpp
)
set(NETLIB_HTTP
src/http/client.hpp
src/http/http.hpp
)
option(BUILD_TESTS "Build tests" ON)
option(BUILD_EXAMPLES "Build example programs" ON)
option(WITH_HTTP "Build with http support" ON)
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/doctest/CMakeLists.txt")
set(BUILD_TESTS OFF)
message(WARNING "Cannot build tests without doctest! Deactivating tests.")
endif()
if (WITH_HTTP)
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/extern/cpp-uri-parser/URI.hpp")
set(WITH_HTTP OFF)
message(WARNING "If you want HTTP support, you need to check out submodules (cpp-uri-parser)")
endif()
message(NOTICE "Building with HTTP support.")
endif()
if(BUILD_TESTS)
# doctest
include_directories(doctest)
add_subdirectory(tests)
endif()
if (BUILD_EXAMPLES)
add_subdirectory(examples)
endif()