forked from microsoft/cpprestsdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
124 lines (115 loc) · 3.28 KB
/
CMakeLists.txt
File metadata and controls
124 lines (115 loc) · 3.28 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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
include_directories(../include pch)
if (NOT CPPREST_EXCLUDE_WEBSOCKETS)
include_directories(${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR})
endif()
set(SOURCES_COMMON
http/client/http_client_msg.cpp
http/client/x509_cert_utilities.cpp
http/common/http_helpers.cpp
http/common/http_msg.cpp
http/listener/http_listener.cpp
http/listener/http_listener_msg.cpp
http/listener/http_server_api.cpp
http/oauth/oauth1.cpp
http/oauth/oauth2.cpp
json/json.cpp
json/json_parsing.cpp
json/json_serialization.cpp
pplx/pplx.cpp
uri/uri.cpp
uri/uri_builder.cpp
uri/uri_parser.cpp
utilities/asyncrt_utils.cpp
utilities/base64.cpp
utilities/web_utilities.cpp
websockets/client/ws_msg.cpp
websockets/client/ws_client.cpp
websockets/client/ws_client_wspp.cpp
)
# THE ORDER OF FILES IS VERY /VERY/ IMPORTANT
if(UNIX)
set(SOURCES
${SOURCES_COMMON}
streams/fileio_posix.cpp
pplx/threadpool.cpp
http/client/http_client_asio.cpp
http/listener/http_server_asio.cpp
)
if(APPLE)
list(APPEND SOURCES
pplx/pplxapple.cpp
http/client/x509_cert_utilities_apple.cpp
)
find_library(COREFOUNDATION CoreFoundation "/")
find_library(SECURITY Security "/")
set(EXTRALINKS ${COREFOUNDATION} ${SECURITY})
elseif(ANDROID)
list(APPEND SOURCES
http/client/x509_cert_utilities_android.cpp
pplx/pplxlinux.cpp
)
else()
list(APPEND SOURCES pplx/pplxlinux.cpp)
endif()
if(WERROR)
set(WARNINGS "${WARNINGS} -Werror")
endif()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNINGS} -pedantic")
elseif(WIN32)
set(SOURCES
${SOURCES_COMMON}
http/client/http_client_winhttp.cpp
http/client/x509_cert_utilities_win32.cpp
http/listener/http_server_httpsys.cpp
pplx/pplxwin.cpp
streams/fileio_win32.cpp
pch/stdafx.cpp
)
set(EXTRALINKS
bcrypt.lib
crypt32.lib
httpapi.lib
Winhttp.lib
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNINGS}")
if (${CMAKE_GENERATOR} MATCHES "Visual Studio .*")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Yustdafx.h /Zm200")
set_source_files_properties(pch/stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
endif()
if (BUILD_SHARED_LIBS)
add_definitions(-D_ASYNCRT_EXPORT -D_PPLX_EXPORT -D_USRDLL)
endif()
endif()
add_library(${Casablanca_LIBRARY} ${SOURCES})
target_link_libraries(${Casablanca_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${Boost_ATOMIC_LIBRARY}
${Boost_CHRONO_LIBRARY}
${Boost_RANDOM_LIBRARY}
${EXTRALINKS}
${Boost_FRAMEWORK}
${OPENSSL_LIBRARIES}
${COREFOUNDATION}
${ANDROID_STL_FLAGS}
)
# Portions specific to cpprest binary versioning.
set (CPPREST_VERSION_MAJOR 2)
set (CPPREST_VERSION_MINOR 8)
set (CPPREST_VERSION_REVISION 0)
if(WIN32)
set_target_properties(${Casablanca_LIBRARY} PROPERTIES
OUTPUT_NAME "${Casablanca_LIBRARY}_${CPPREST_VERSION_MAJOR}_${CPPREST_VERSION_MINOR}")
elseif(ANDROID)
# Do not use SOVERSION on android. It is completely unsupported (and causes problems).
# Perhaps revisit in the future? (NDK r9d, 8/7/14)
else()
set_target_properties(${Casablanca_LIBRARY} PROPERTIES
SOVERSION ${CPPREST_VERSION_MAJOR}.${CPPREST_VERSION_MINOR})
install(
TARGETS ${Casablanca_LIBRARY}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
endif()