Skip to content

Commit 57a64e3

Browse files
authored
Merge pull request #14 from j-ulrich/bugfix/#12
Fixes CI build issues
2 parents 60c9808 + 141ddef commit 57a64e3

File tree

6 files changed

+73
-47
lines changed

6 files changed

+73
-47
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ environment:
44
CTEST_OUTPUT_ON_FAILURE: '1'
55
matrix:
66
- CMAKE_GENERATOR: Visual Studio 15 2017 Win64
7-
QT_DIR: C:\Qt\5.11\msvc2017_64
7+
QT_DIR: C:\Qt\5.12\msvc2017_64
88
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
99
VCVARS_COMMANDLINE: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"'
1010
- CMAKE_GENERATOR: Visual Studio 14 2015

CHANGELOG.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Changelog # {#changelog}
1+
# Changelog #
22

3-
\brief The changelog of the http-status-codes library.
3+
The changelog of the http-status-codes library.
44

55
This project adheres to [Semantic Versioning](http://semver.org/).
66

@@ -10,6 +10,16 @@ This changelog follows the [Keep a Changelog](http://keepachangelog.com) format.
1010
---
1111

1212

13+
## Unreleased ##
14+
15+
### Changed ###
16+
17+
- [#12] Updated GTest to 1.8.1 to fix deprecation warnings with recent compilers.
18+
19+
20+
---
21+
22+
1323
## [1.3.0] - 2019-02-21 ##
1424

1525
### Added ###
@@ -64,6 +74,7 @@ Initial (actually unversioned) release.
6474
---
6575

6676

77+
[1.3.0]: https://github.com/j-ulrich/http-status-codes-cpp/releases/tag/1.3.0
6778
[1.2.0]: https://github.com/j-ulrich/http-status-codes-cpp/releases/tag/1.2.0
6879
[1.1.1]: https://github.com/j-ulrich/http-status-codes-cpp/releases/tag/1.1.1
6980
[1.1.0]: https://github.com/j-ulrich/http-status-codes-cpp/releases/tag/1.1.0

README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ Might also be working with Qt 4 versions but this has not been tested.
4646
#include "HttpStatusCodes_C++.h"
4747
#include <iostream>
4848

49-
void printReplyStatus(MyHttpReplyClass reply)
49+
void printReplyStatus( MyHttpReplyClass reply )
5050
{
51-
if (reply.status == HttpStatus::OK)
51+
if ( reply.status == HttpStatus::OK )
5252
std::cout << "Success!";
5353
else
54-
std::cerr << reply.status << " " << HttpStatus::reasonPhrase(reply.status);
54+
std::cerr << reply.status << " " << HttpStatus::reasonPhrase( reply.status );
5555
}
5656
```
5757
@@ -107,17 +107,17 @@ enum Code
107107

108108
##### C Variant #####
109109
```c
110-
char HttpStatus_isInformational(int code);
111-
char HttpStatus_isSuccessful(int code);
112-
char HttpStatus_isRedirection(int code);
113-
char HttpStatus_isClientError(int code);
114-
char HttpStatus_isServerError(int code);
110+
char HttpStatus_isInformational( int code );
111+
char HttpStatus_isSuccessful( int code );
112+
char HttpStatus_isRedirection( int code );
113+
char HttpStatus_isClientError( int code );
114+
char HttpStatus_isServerError( int code );
115115
```
116116
Return `1` if the given _code_ belongs to the corresponding class of status codes (see [RFC7231](https://tools.ietf.org/html/rfc7231#section-6)).
117117
Return `0` otherwise.
118118
119119
```c
120-
char HttpStatus_isError(int code);
120+
char HttpStatus_isError( int code);
121121
```
122122
Returns `1` if the given _code_ is either a client error, a server error or any non-standard error code.
123123
Non-standard error codes are status codes with a value of 600 or higher.
@@ -127,19 +127,19 @@ Returns `0` otherwise.
127127
> **Note:** The C++11 variant also provides overloads for `HttpStatus::Code`. So there is no need to cast.
128128
129129
```c++
130-
bool HttpStatus::isInformational(int code);
131-
bool HttpStatus::isSuccessful(int code);
132-
bool HttpStatus::isRedirection(int code);
133-
bool HttpStatus::isClientError(int code);
134-
bool HttpStatus::isServerError(int code);
130+
bool HttpStatus::isInformational( int code );
131+
bool HttpStatus::isSuccessful( int code );
132+
bool HttpStatus::isRedirection( int code );
133+
bool HttpStatus::isClientError( int code );
134+
bool HttpStatus::isServerError( int code );
135135
```
136136
Return `true` if the given _code_ belongs to the corresponding class of status codes (see [RFC7231](https://tools.ietf.org/html/rfc7231#section-6)).
137137
Return `false` otherwise.
138138
139139
140140
141141
```c++
142-
bool HttpStatus::isError(int code);
142+
bool HttpStatus::isError( int code );
143143
```
144144
Returns `true` if the given _code_ is either a client error, a server error or any non-standard error code.
145145
Non-standard error codes are status codes with a value of 600 or higher.
@@ -150,20 +150,20 @@ Returns `false` otherwise.
150150

151151
##### C Variant #####
152152
```c
153-
const char* HttpStatus_reasonPhrase(int code);
153+
const char* HttpStatus_reasonPhrase( int code );
154154
```
155155
Returns the HTTP reason phrase string corresponding to the given _code_.
156156
157157
##### C++/C++11 Variants #####
158158
> **Note:** The C++11 variant also provides an overload for `HttpStatus::Code`. So there is no need to cast.
159159
```c++
160-
std::string HttpStatus::reasonPhrase(int code);
160+
std::string HttpStatus::reasonPhrase( int code );
161161
```
162162
Returns the HTTP reason phrase string corresponding to the given _code_.
163163

164164
##### Qt Variant #####
165165
```c++
166-
QString HttpStatus::reasonPhrase(int code);
166+
QString HttpStatus::reasonPhrase( int code );
167167
```
168168
Returns the HTTP reason phrase string corresponding to the given _code_.
169169
@@ -172,20 +172,20 @@ Returns the HTTP reason phrase string corresponding to the given _code_.
172172
173173
##### C++11 Variant #####
174174
```c++
175-
int HttpStatus::toInt(HttpStatus::Code code);
175+
int HttpStatus::toInt( HttpStatus::Code code );
176176
```
177177
Returns the integer value corresponding to a given a _code_.
178178
This is a convenience function as replacement for a `static_cast<int>()`.
179179

180180
##### Qt Variant #####
181181
```c++
182-
int HttpStatus::networkErrorToStatusCode(QNetworkReply::NetworkError error);
182+
int HttpStatus::networkErrorToStatusCode( QNetworkReply::NetworkError error );
183183
```
184184
Returns the HTTP status code corresponding to the given _error_ if there is one.
185185
Otherwise, `-1` is returned.
186186
187187
```c++
188-
QNetworkReply::NetworkError HttpStatus::statusCodeToNetworkError(int code);
188+
QNetworkReply::NetworkError HttpStatus::statusCodeToNetworkError( int code );
189189
```
190190
Returns the `QNetworkReply::NetworkError` corresponding to the given _code_ if there is one.
191191
For codes where there is no exact match, the best matching "catch all" code (`QNetworkReply::NoError`,

tests/CMakeLists.txt

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 3.0)
22

33
# Package Management using Hunter
44
include("cmake/HunterGate.cmake")
5-
65
HunterGate(
7-
URL "https://github.com/ruslo/hunter/archive/v0.23.28.tar.gz"
8-
SHA1 "6c79b36253a8e8bcba48927e9f3be65a3a81e6ec"
6+
URL "https://github.com/cpp-pm/hunter/archive/v0.23.224.tar.gz"
7+
SHA1 "18e57a43efc435f2e1dae1291e82e42afbf940be"
8+
LOCAL
99
)
1010

1111
project(HttpStatusCodesTests)
@@ -14,13 +14,19 @@ set (CMAKE_CXX_STANDARD 11)
1414

1515
hunter_add_package(GTest)
1616
find_package(GTest CONFIG REQUIRED)
17+
message( "GTest_VERSION: ${GTest_VERSION}" )
18+
if( GTest_VERSION VERSION_LESS "1.9.0" )
19+
set( GTEST_MAIN GTest::main )
20+
else()
21+
set( GTEST_MAIN GTest::gtest_main )
22+
endif()
1723

1824
enable_testing()
1925

2026
include_directories(${PROJECT_SOURCE_DIR}/..)
2127

2228
add_executable(CVariantTest CVariantTest.cpp)
23-
target_link_libraries(CVariantTest GTest::main)
29+
target_link_libraries(CVariantTest ${GTEST_MAIN})
2430
add_test(NAME CVariantTest COMMAND CVariantTest)
2531

2632
add_executable(CVariantCompileTest CVariantCompileTest.c)
@@ -32,7 +38,7 @@ set_target_properties(CVariantCompileTest PROPERTIES
3238
)
3339

3440
add_executable(C++VariantTest C++VariantTest.cpp)
35-
target_link_libraries(C++VariantTest GTest::main)
41+
target_link_libraries(C++VariantTest ${GTEST_MAIN})
3642
add_test(NAME C++VariantTest COMMAND C++VariantTest)
3743
set_target_properties(C++VariantTest PROPERTIES
3844
CXX_STANDARD 98
@@ -49,7 +55,7 @@ endif()
4955

5056
if(CXX_SUPPORTS_STRONG_ENUMS)
5157
add_executable(C++11VariantTest C++11VariantTest.cpp)
52-
target_link_libraries(C++11VariantTest GTest::main)
58+
target_link_libraries(C++11VariantTest ${GTEST_MAIN})
5359
add_test(NAME C++11VariantTest COMMAND C++11VariantTest)
5460
set_target_properties(C++11VariantTest PROPERTIES
5561
CXX_STANDARD 11
@@ -88,6 +94,9 @@ endif()
8894

8995
if (QTCORE_LIB)
9096
add_executable(QtVariantTest QtVariantTest.cpp "${PROJECT_SOURCE_DIR}/../HttpStatusCodes_Qt.h")
91-
target_link_libraries(QtVariantTest GTest::main ${QTCORE_LIB} ${QTNETWORK_LIB})
97+
target_link_libraries(QtVariantTest ${GTEST_MAIN} ${QTCORE_LIB} ${QTNETWORK_LIB})
9298
add_test(NAME QtVariantTest COMMAND QtVariantTest)
99+
if (WIN32)
100+
set_tests_properties( QtVariantTest PROPERTIES ENVIRONMENT "PATH=$<TARGET_FILE_DIR:${QTCORE_LIB}>;$ENV{PATH}" )
101+
endif()
93102
endif()

tests/cmake/Hunter/config.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
if ( WIN32 AND ( MSVC_TOOLSET_VERSION LESS 140 ) )
3+
# Visual Studio < 2015
4+
hunter_config( GTest VERSION 1.8.0-hunter-p11 )
5+
else()
6+
hunter_config( GTest VERSION 1.8.1 ) # Actually, this results in GTest version 1.9.0
7+
endif()

tests/cmake/HunterGate.cmake

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2013-2018, Ruslan Baratov
1+
# Copyright (c) 2013-2019, Ruslan Baratov
22
# All rights reserved.
33
#
44
# Redistribution and use in source and binary forms, with or without
@@ -60,7 +60,7 @@ option(HUNTER_STATUS_PRINT "Print working status" ON)
6060
option(HUNTER_STATUS_DEBUG "Print a lot info" OFF)
6161
option(HUNTER_TLS_VERIFY "Enable/disable TLS certificate checking on downloads" ON)
6262

63-
set(HUNTER_WIKI "https://github.com/ruslo/hunter/wiki")
63+
set(HUNTER_ERROR_PAGE "https://docs.hunter.sh/en/latest/reference/errors")
6464

6565
function(hunter_gate_status_print)
6666
if(HUNTER_STATUS_PRINT OR HUNTER_STATUS_DEBUG)
@@ -79,9 +79,9 @@ function(hunter_gate_status_debug)
7979
endif()
8080
endfunction()
8181

82-
function(hunter_gate_wiki wiki_page)
83-
message("------------------------------ WIKI -------------------------------")
84-
message(" ${HUNTER_WIKI}/${wiki_page}")
82+
function(hunter_gate_error_page error_page)
83+
message("------------------------------ ERROR ------------------------------")
84+
message(" ${HUNTER_ERROR_PAGE}/${error_page}.html")
8585
message("-------------------------------------------------------------------")
8686
message("")
8787
message(FATAL_ERROR "")
@@ -94,26 +94,25 @@ function(hunter_gate_internal_error)
9494
endforeach()
9595
message("[hunter ** INTERNAL **] [Directory:${CMAKE_CURRENT_LIST_DIR}]")
9696
message("")
97-
hunter_gate_wiki("error.internal")
97+
hunter_gate_error_page("error.internal")
9898
endfunction()
9999

100100
function(hunter_gate_fatal_error)
101-
cmake_parse_arguments(hunter "" "WIKI" "" "${ARGV}")
102-
string(COMPARE EQUAL "${hunter_WIKI}" "" have_no_wiki)
103-
if(have_no_wiki)
104-
hunter_gate_internal_error("Expected wiki")
101+
cmake_parse_arguments(hunter "" "ERROR_PAGE" "" "${ARGV}")
102+
if("${hunter_ERROR_PAGE}" STREQUAL "")
103+
hunter_gate_internal_error("Expected ERROR_PAGE")
105104
endif()
106105
message("")
107106
foreach(x ${hunter_UNPARSED_ARGUMENTS})
108107
message("[hunter ** FATAL ERROR **] ${x}")
109108
endforeach()
110109
message("[hunter ** FATAL ERROR **] [Directory:${CMAKE_CURRENT_LIST_DIR}]")
111110
message("")
112-
hunter_gate_wiki("${hunter_WIKI}")
111+
hunter_gate_error_page("${hunter_ERROR_PAGE}")
113112
endfunction()
114113

115114
function(hunter_gate_user_error)
116-
hunter_gate_fatal_error(${ARGV} WIKI "error.incorrect.input.data")
115+
hunter_gate_fatal_error(${ARGV} ERROR_PAGE "error.incorrect.input.data")
117116
endfunction()
118117

119118
function(hunter_gate_self root version sha1 result)
@@ -195,7 +194,7 @@ function(hunter_gate_detect_root)
195194

196195
hunter_gate_fatal_error(
197196
"Can't detect HUNTER_ROOT"
198-
WIKI "error.detect.hunter.root"
197+
ERROR_PAGE "error.detect.hunter.root"
199198
)
200199
endfunction()
201200

@@ -214,7 +213,7 @@ function(hunter_gate_download dir)
214213
"Settings:"
215214
" HUNTER_ROOT: ${HUNTER_GATE_ROOT}"
216215
" HUNTER_SHA1: ${HUNTER_GATE_SHA1}"
217-
WIKI "error.run.install"
216+
ERROR_PAGE "error.run.install"
218217
)
219218
endif()
220219
string(COMPARE EQUAL "${dir}" "" is_bad)
@@ -400,7 +399,7 @@ macro(HunterGate)
400399
hunter_gate_fatal_error(
401400
"Please set HunterGate *before* 'project' command. "
402401
"Detected project: ${PROJECT_NAME}"
403-
WIKI "error.huntergate.before.project"
402+
ERROR_PAGE "error.huntergate.before.project"
404403
)
405404
endif()
406405

@@ -470,7 +469,7 @@ macro(HunterGate)
470469
"HUNTER_ROOT (${HUNTER_GATE_ROOT}) contains spaces."
471470
"Set HUNTER_ALLOW_SPACES_IN_PATH=ON to skip this error"
472471
"(Use at your own risk!)"
473-
WIKI "error.spaces.in.hunter.root"
472+
ERROR_PAGE "error.spaces.in.hunter.root"
474473
)
475474
endif()
476475
endif()

0 commit comments

Comments
 (0)