Clang 13+ doesn't play nice with fmt >= 8.0.0 if
"consteval" is enabled. Turn it off.
It chokes when `fmt::format_to()` is called with a
`std::string_view` or `const char*` format string,
always trying to use consteval constructor for
`basic_format_string`.
It can be worked around by either wrapping format
strings in a `fmt::runtime()` or just disabling the
consteval support in fmtlib. The second approach
seems to be simpler.
Now the compilation passes successfully for the
default toolchain based on Fedora 35 Pre-Release.
Signed-off-by: Pavel Solodovnikov <
pa.solo...@scylladb.com>
---
CMakeLists.txt | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a63b3b4c..7f10f792 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -981,6 +981,19 @@ if ((CMAKE_BUILD_TYPE STREQUAL "Dev") OR (CMAKE_BUILD_TYPE STREQUAL "Debug"))
SEASTAR_TYPE_ERASE_MORE)
endif ()
+# Clang 13+ doesn't play nice with fmt >= 8.0.0 if "consteval" is enabled. Turn it off.
+#
+# It chokes when `fmt::format_to()` is called with a `std::string_view` or `const char*`
+# format string, always trying to use consteval constructor for `basic_format_string`.
+#
+# It can be worked around by either wrapping format strings in a `fmt::runtime()` or
+# just disabling the consteval support in fmtlib. The second approach seems to be simpler.
+if (CMAKE_CXX_COMPILER_ID MATCHES Clang AND
+ CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13 AND
+ fmt_VERSION VERSION_GREATER_EQUAL 8.0.0)
+ target_compile_definitions (seastar PUBLIC FMT_CONSTEVAL=)
+endif()
+
target_compile_definitions (seastar
PRIVATE ${Seastar_PRIVATE_COMPILE_DEFINITIONS})
--
2.32.0