From 0daacf203a311a23bdc07baa2c850a2fae55b0c1 Mon Sep 17 00:00:00 2001 From: Laszlo Nagy Date: Sun, 27 Aug 2023 19:44:50 +1000 Subject: [PATCH] citnames: protect fmt/std.h with include guard --- source/CMakeLists.txt | 3 +++ source/citnames/source/semantic/Semantic.cc | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index fe6b710b..0ccc5d83 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -30,8 +30,11 @@ find_package(PkgConfig REQUIRED) pkg_check_modules(gRPC REQUIRED IMPORTED_TARGET protobuf grpc++) if (fmt_VERSION_MAJOR GREATER_EQUAL 9) + message(STATUS "fmt dependency version >= 9") set(FMT_NEEDS_OSTREAM_FORMATTER 1) set(HAVE_FMT_STD_H 1) # FIXME: this should be done with `check_include_file` +else () + message(STATUS "fmt dependency version < 9") endif () if (UNIX AND NOT APPLE) diff --git a/source/citnames/source/semantic/Semantic.cc b/source/citnames/source/semantic/Semantic.cc index 09742388..e82ee658 100644 --- a/source/citnames/source/semantic/Semantic.cc +++ b/source/citnames/source/semantic/Semantic.cc @@ -20,7 +20,14 @@ #include "semantic/Semantic.h" #include +#ifdef HAVE_FMT_STD_H #include +#else +namespace fmt { + template <> + struct formatter : formatter {}; +} +#endif namespace cs::semantic {