Skip to content

Commit 37df2d3

Browse files
authored
Merge pull request microsoft#206 from ajneu/development_headers_proxy
remove warnings-errors for system-headers under linux; honour http_proxy env-variable
2 parents 08bf1a7 + 02119a1 commit 37df2d3

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

Release/CMakeLists.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ if(ANDROID)
149149
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-strict-aliasing")
150150
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pedantic")
151151
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes -Wno-pointer-arith")
152-
include_directories(
152+
include_directories(SYSTEM
153153
"${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.8/include"
154154
"${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include"
155155
"${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.8/include/backward"
@@ -197,7 +197,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Binaries)
197197
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Binaries)
198198

199199
# These settings can be used by the test targets
200-
set(Casablanca_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
200+
set(Casablanca_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
201201
if (NOT CPPREST_EXCLUDE_WEBSOCKETS)
202202
find_path(WEBSOCKETPP_CONFIG websocketpp-config.cmake
203203
HINTS /usr/lib/cmake/websocketpp)
@@ -207,20 +207,19 @@ if (NOT CPPREST_EXCLUDE_WEBSOCKETS)
207207
include(${WEBSOCKETPP_CONFIG}/websocketpp-config.cmake)
208208
include(${WEBSOCKETPP_CONFIG}/websocketpp-configVersion.cmake)
209209
message("-- Found websocketpp version " ${PACKAGE_VERSION} " on system")
210-
set(Casablanca_INCLUDE_DIRS ${Casablanca_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} ${WEBSOCKETPP_INCLUDE_DIR})
210+
set(Casablanca_SYSTEM_INCLUDE_DIRS ${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} ${WEBSOCKETPP_INCLUDE_DIR})
211211
else(WEBSOCKETPP_CONFIG AND WEBSOCKETPP_CONFIG_VERSION)
212-
set(Casablanca_INCLUDE_DIRS ${Casablanca_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libs/websocketpp)
212+
set(Casablanca_SYSTEM_INCLUDE_DIRS ${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libs/websocketpp)
213213
message("-- websocketpp not found, using the embedded version")
214214
endif(WEBSOCKETPP_CONFIG AND WEBSOCKETPP_CONFIG_VERSION)
215-
else()
216-
set(Casablanca_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
217215
endif()
218216

219217
set(Casablanca_LIBRARY cpprest)
220218
set(Casablanca_LIBRARIES cpprest ${Boost_LIBRARIES})
221219

222220
# Everything in the project needs access to the casablanca include directories
223-
include_directories(${Casablanca_INCLUDE_DIRS})
221+
include_directories( ${Casablanca_INCLUDE_DIRS})
222+
include_directories(SYSTEM ${Casablanca_SYSTEM_INCLUDE_DIRS})
224223

225224
# Finally, the tests all use the same style declaration to build themselves, so we use a function
226225
function(add_casablanca_test NAME SOURCES_VAR)

Release/libs/websocketpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ if (BUILD_TESTS OR BUILD_EXAMPLES)
190190

191191
if (Boost_FOUND)
192192
# Boost is a project wide global dependency.
193-
include_directories (${Boost_INCLUDE_DIRS})
193+
include_directories (SYSTEM ${Boost_INCLUDE_DIRS})
194194
link_directories (${Boost_LIBRARY_DIRS})
195195

196196
# Pretty print status

Release/samples/BingRequest/bingrequest.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,23 @@ using namespace web::http;
3030
using namespace web::http::client;
3131
using namespace concurrency::streams;
3232

33+
/* Can pass proxy information via environment variable http_proxy.
34+
Example:
35+
Linux: export http_proxy=http://192.1.8.1:8080
36+
*/
37+
web::http::client::http_client_config client_config_for_proxy()
38+
{
39+
web::http::client::http_client_config client_config;
40+
41+
if(const char* env_http_proxy = std::getenv("http_proxy")) {
42+
web::web_proxy proxy(env_http_proxy);
43+
client_config.set_proxy(proxy);
44+
}
45+
46+
return client_config;
47+
}
48+
49+
3350
#ifdef _WIN32
3451
int wmain(int argc, wchar_t *args[])
3552
#else
@@ -52,7 +69,7 @@ int main(int argc, char *args[])
5269

5370
// Create an HTTP request.
5471
// Encode the URI query since it could contain special characters like spaces.
55-
http_client client(U("http://www.bing.com/"));
72+
http_client client(U("http://www.bing.com/"), client_config_for_proxy());
5673
return client.request(methods::GET, uri_builder(U("/search")).append_query(U("q"), searchTerm).to_string());
5774
})
5875

@@ -74,4 +91,4 @@ int main(int argc, char *args[])
7491
.wait();
7592

7693
return 0;
77-
}
94+
}

Release/src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
include_directories(../include pch)
22
if (NOT CPPREST_EXCLUDE_WEBSOCKETS)
3-
include_directories(${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR})
3+
include_directories(SYSTEM ${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR})
44
endif()
55

66
add_definitions(${WARNINGS})

0 commit comments

Comments
 (0)