Fixes #317: Make use of ASIO_STANDALONE when using standalone asio in order to compile on older asio versions without boost

This commit is contained in:
eidheim 2021-03-26 10:02:04 +01:00
commit 1bb89e1e8e
6 changed files with 8 additions and 8 deletions

View file

@ -21,7 +21,7 @@ target_link_libraries(simple-web-server INTERFACE ${CMAKE_THREAD_LIBS_INIT})
# TODO 2020 when Debian Jessie LTS ends:
# Remove Boost system, thread, regex components; use Boost::<component> aliases; remove Boost target_include_directories
if(USE_STANDALONE_ASIO)
target_compile_definitions(simple-web-server INTERFACE USE_STANDALONE_ASIO)
target_compile_definitions(simple-web-server INTERFACE ASIO_STANDALONE)
find_path(ASIO_PATH asio.hpp)
if(NOT ASIO_PATH)
message(FATAL_ERROR "Standalone Asio not found")

View file

@ -3,7 +3,7 @@
#include <memory>
#ifdef USE_STANDALONE_ASIO
#ifdef ASIO_STANDALONE
#include <asio.hpp>
#include <asio/steady_timer.hpp>
namespace SimpleWeb {
@ -27,7 +27,7 @@ namespace SimpleWeb {
#endif
namespace SimpleWeb {
#if(USE_STANDALONE_ASIO && ASIO_VERSION >= 101300) || BOOST_ASIO_VERSION >= 101300
#if(ASIO_STANDALONE && ASIO_VERSION >= 101300) || BOOST_ASIO_VERSION >= 101300
using io_context = asio::io_context;
using resolver_results = asio::ip::tcp::resolver::results_type;
using async_connect_endpoint = asio::ip::tcp::endpoint;

View file

@ -50,14 +50,14 @@ namespace SimpleWeb {
}
};
} // namespace SimpleWeb
#ifndef USE_STANDALONE_ASIO
#ifndef ASIO_STANDALONE
namespace boost {
#endif
namespace asio {
template <>
struct is_match_condition<SimpleWeb::HeaderEndMatch> : public std::true_type {};
} // namespace asio
#ifndef USE_STANDALONE_ASIO
#ifndef ASIO_STANDALONE
} // namespace boost
#endif

View file

@ -3,7 +3,7 @@
#include "client_http.hpp"
#ifdef USE_STANDALONE_ASIO
#ifdef ASIO_STANDALONE
#include <asio/ssl.hpp>
#else
#include <boost/asio/ssl.hpp>

View file

@ -3,7 +3,7 @@
#include "server_http.hpp"
#ifdef USE_STANDALONE_ASIO
#ifdef ASIO_STANDALONE
#include <asio/ssl.hpp>
#else
#include <boost/asio/ssl.hpp>

View file

@ -27,7 +27,7 @@
namespace SimpleWeb {
using string_view = std::string_view;
}
#elif !defined(USE_STANDALONE_ASIO)
#elif !defined(ASIO_STANDALONE)
#include <boost/utility/string_ref.hpp>
namespace SimpleWeb {
using string_view = boost::string_ref;