forked from nativeformat/NFHTTP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
118 lines (104 loc) · 3.37 KB
/
CMakeLists.txt
File metadata and controls
118 lines (104 loc) · 3.37 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
# Copyright (c) 2018 Spotify AB.
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set(SOURCE_FILES
Client.cpp
CachingClient.h
CachingClient.cpp
Request.cpp
RequestImplementation.cpp
ClientNSURLSession.h
ClientNSURLSession.mm
RequestTokenImplementation.h
RequestTokenImplementation.cpp
RequestTokenDelegate.h
ResponseImplementation.cpp
sha256.h
sha256.cpp
CachingDatabase.h
CachingDatabase.cpp
CachingSQLiteDatabase.h
CachingSQLiteDatabase.cpp
CachingDatabaseDelegate.h
CacheLocationLinux.cpp
CacheLocationApple.mm
CacheLocationWindows.cpp
ClientModifierImplementation.h
ClientModifierImplementation.cpp
RequestImplementation.h
ClientMultiRequestImplementation.h
ClientMultiRequestImplementation.cpp
NFHTTP.cpp)
if(USE_CURL)
list(APPEND
SOURCE_FILES
ClientCurl.h
ClientCurl.cpp)
find_path(CURL_INCLUDE_DIR NAMES curl/curl.h)
mark_as_advanced(CURL_INCLUDE_DIR)
endif()
if(USE_CPPRESTSDK)
list(APPEND
SOURCE_FILES
ClientCpprestsdk.h
ClientCpprestsdk.cpp)
endif()
add_library(NFHTTP "${NFHTTP_INCLUDE_DIRECTORY}/NFHTTP/Client.h"
"${NFHTTP_INCLUDE_DIRECTORY}/NFHTTP/Request.h"
"${NFHTTP_INCLUDE_DIRECTORY}/NFHTTP/RequestToken.h"
"${NFHTTP_INCLUDE_DIRECTORY}/NFHTTP/Response.h"
"${NFHTTP_INCLUDE_DIRECTORY}/NFHTTP/ResponseImplementation.h"
"${NFHTTP_INCLUDE_DIRECTORY}/NFHTTP/NFHTTP.h"
${SOURCE_FILES})
target_include_directories(NFHTTP PUBLIC "${NFHTTP_INCLUDE_DIRECTORY}"
"${NFHTTP_LIBRARIES_DIRECTORY}/sqlite"
"${NFHTTP_LIBRARIES_DIRECTORY}/curl/include"
${CPPREST_INCLUDE_DIR}
${OUTPUT_DIRECTORY})
set(LINK_LIBRARIES sqlite)
if(NOT WIN32 AND NOT ANDROID)
set(LINK_LIBRARIES sqlite pthread)
endif()
add_executable(NFHTTPCLI NFHTTPCLI.cpp)
target_include_directories(NFHTTPCLI PUBLIC "${NFHTTP_INCLUDE_DIRECTORY}"
"${NFHTTP_LIBRARIES_DIRECTORY}/sqlite"
"${NFHTTP_LIBRARIES_DIRECTORY}/curl/include"
${CPPREST_INCLUDE_DIR}
${OUTPUT_DIRECTORY})
if(USE_CURL)
list(APPEND LINK_LIBRARIES libcurl)
if(NOT ANDROID)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lcurl")
endif()
endif()
if(USE_CPPRESTSDK)
list(APPEND LINK_LIBRARIES cpprest)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_library(FOUNDATION Foundation)
list(APPEND LINK_LIBRARIES ${FOUNDATION})
set_source_files_properties(ClientNSURLSession.mm
PROPERTIES COMPILE_FLAGS "-fobjc-arc")
set_source_files_properties(CacheLocationApple.mm
PROPERTIES COMPILE_FLAGS "-fobjc-arc")
endif()
target_link_libraries(NFHTTP PUBLIC ${LINK_LIBRARIES} nlohmann_json)
target_link_libraries(NFHTTPCLI NFHTTP nlohmann_json)
if(USE_CURL)
target_compile_definitions(NFHTTP PRIVATE USE_CURL=1)
endif()