From fc0750bf5c0e16abc8423f38a88118c3640ca75d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= Date: Wed, 4 Mar 2020 08:44:00 -0800 Subject: [PATCH] cmake: Add an option for using std::string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With this basic_sstring is still available for code that needs the extra features. It is just sstring that is aliased to std::string. The default is still to use sstring. Signed-off-by: Rafael Ávila de Espíndola --- CMakeLists.txt | 8 ++++++++ include/seastar/core/sstring.hh | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a26ead6546a..1bf4f4aba04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,10 @@ option (Seastar_EXPERIMENTAL_COROUTINES_TS "Enable experimental support for Coroutines TS." OFF) +option (Seastar_SSTRING + "Use seastar's own string implementation" + ON) + set (Seastar_API_LEVEL "2" CACHE @@ -745,6 +749,10 @@ if (Seastar_EXPERIMENTAL_COROUTINES_TS) target_compile_definitions (seastar PUBLIC SEASTAR_COROUTINES_TS) endif () +if (Seastar_SSTRING) + target_compile_options (seastar PUBLIC -DSEASTAR_SSTRING) +endif () + if (Seastar_GCC6_CONCEPTS OR Concepts_FOUND) target_compile_definitions (seastar PUBLIC SEASTAR_HAVE_GCC6_CONCEPTS) diff --git a/include/seastar/core/sstring.hh b/include/seastar/core/sstring.hh index 69f7f121bd2..479835b7f7f 100644 --- a/include/seastar/core/sstring.hh +++ b/include/seastar/core/sstring.hh @@ -42,7 +42,11 @@ namespace seastar { template class basic_sstring; +#ifdef SEASTAR_SSTRING using sstring = basic_sstring; +#else +using sstring = std::string; +#endif template class basic_sstring {