forked from tdlight-team/tdlight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
88 lines (78 loc) · 2.29 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
if ((CMAKE_MAJOR_VERSION LESS 3) OR (CMAKE_VERSION VERSION_LESS "3.0.2"))
message(FATAL_ERROR "CMake >= 3.0.2 is required")
endif()
if (NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR "lib")
endif()
if (NOT OPENSSL_FOUND)
find_package(OpenSSL REQUIRED)
find_package(ZLIB REQUIRED)
endif()
#SOURCE SETS
set(TDNET_SOURCE
td/net/GetHostByNameActor.cpp
td/net/HttpChunkedByteFlow.cpp
td/net/HttpConnectionBase.cpp
td/net/HttpContentLengthByteFlow.cpp
td/net/HttpFile.cpp
td/net/HttpInboundConnection.cpp
td/net/HttpOutboundConnection.cpp
td/net/HttpProxy.cpp
td/net/HttpQuery.cpp
td/net/HttpReader.cpp
td/net/Socks5.cpp
td/net/SslStream.cpp
td/net/TcpListener.cpp
td/net/TransparentProxy.cpp
td/net/Wget.cpp
td/net/GetHostByNameActor.h
td/net/HttpChunkedByteFlow.h
td/net/HttpConnectionBase.h
td/net/HttpContentLengthByteFlow.h
td/net/HttpFile.h
td/net/HttpHeaderCreator.h
td/net/HttpInboundConnection.h
td/net/HttpOutboundConnection.h
td/net/HttpProxy.h
td/net/HttpQuery.h
td/net/HttpReader.h
td/net/NetStats.h
td/net/Socks5.h
td/net/SslStream.h
td/net/TcpListener.h
td/net/TransparentProxy.h
td/net/Wget.h
)
if (APPLE_WATCH)
set(TDNET_SOURCE
${TDNET_SOURCE}
td/net/DarwinHttp.mm
td/net/DarwinHttp.h
)
set_source_files_properties(td/net/DarwinHttp.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
endif()
#RULES
#LIBRARIES
add_library(tdnet STATIC ${TDNET_SOURCE})
target_include_directories(tdnet PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
target_include_directories(tdnet SYSTEM PRIVATE $<BUILD_INTERFACE:${OPENSSL_INCLUDE_DIR}>)
target_link_libraries(tdnet PUBLIC tdutils tdactor)
if (NOT EMSCRIPTEN)
target_link_libraries(tdnet PRIVATE ${OPENSSL_SSL_LIBRARY})
endif()
target_link_libraries(tdnet PRIVATE ${OPENSSL_CRYPTO_LIBRARY} ${CMAKE_DL_LIBS} ${ZLIB_LIBRARIES})
if (WIN32)
if (MINGW)
target_link_libraries(tdnet PRIVATE ws2_32 mswsock crypt32)
else()
target_link_libraries(tdnet PRIVATE ws2_32 Mswsock Crypt32)
endif()
endif()
if (APPLE_WATCH)
find_library(FOUNDATION_LIBRARY Foundation REQUIRED)
target_link_libraries(tdnet PRIVATE ${FOUNDATION_LIBRARY})
endif()
install(TARGETS tdnet EXPORT TdTargets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)