Skip to content

Commit 5d81fec

Browse files
author
Raphael Dumusc
authored
Merge pull request #61 from rdumusc/master
Fix Servus build without boost after #47 (fix #60)
2 parents eea68e0 + d9bea64 commit 5d81fec

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

servus/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ set(SERVUS_SOURCES
4040
uri.cpp
4141
)
4242

43-
list(APPEND SERVUS_LINK_LIBRARIES PRIVATE ${CMAKE_THREAD_LIBS_INIT}
44-
${Boost_REGEX_LIBRARY})
43+
list(APPEND SERVUS_LINK_LIBRARIES PRIVATE ${CMAKE_THREAD_LIBS_INIT})
4544
if(MSVC)
4645
list(APPEND SERVUS_LINK_LIBRARIES ws2_32)
4746
endif()
@@ -55,6 +54,9 @@ if(COMMON_USE_CXX03)
5554
list(APPEND SERVUS_LINK_LIBRARIES ${Boost_SYSTEM_LIBRARY}
5655
${Boost_CHRONO_LIBRARY})
5756
endif()
57+
if(BOOST_FOUND)
58+
list(APPEND SERVUS_LINK_LIBRARIES PRIVATE ${Boost_REGEX_LIBRARY})
59+
endif()
5860

5961
set(SERVUS_OMIT_LIBRARY_HEADER ON)
6062
common_library(Servus)

servus/uri.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
#include <sstream>
2828
#include <stdexcept>
2929

30+
#ifdef SERVUS_USE_BOOST
3031
#include <boost/regex.hpp>
32+
#endif
3133

3234
namespace servus
3335
{
@@ -149,21 +151,25 @@ void _parseAuthority( URIData& data, const std::string& auth )
149151
throw std::invalid_argument("");
150152
}
151153

154+
#ifdef SERVUS_USE_BOOST
152155
void _warnAboutLegacySeparator( const std::string& query )
153156
{
154157
const boost::regex legacySeparator( "[^&]*,[^&]*=" );
155158
if( boost::regex_search( query, legacySeparator ))
156159
std::cerr << "servus::URI: Detected legacy ',' separator in query: \""
157160
<< query << "\". Use '&' separator instead." << std::endl;
158161
}
162+
#endif
159163

160164
void _parseQueryMap( URIData& data )
161165
{
162166
// parse query data into key-value pairs
163167
std::string query = data.query;
164168

169+
#ifdef SERVUS_USE_BOOST
165170
// warn if a query uses the legacy ',' separator instead of '&'
166171
_warnAboutLegacySeparator( query );
172+
#endif
167173

168174
data.queryMap.clear();
169175
while( !query.empty( ))

0 commit comments

Comments
 (0)