Skip to content

Commit

Permalink
citnames: protect fmt/std.h with include guard
Browse files Browse the repository at this point in the history
  • Loading branch information
rizsotto committed Aug 27, 2023
1 parent a05fa3a commit 0daacf2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions source/citnames/source/semantic/Semantic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@
#include "semantic/Semantic.h"

#include <fmt/format.h>
#ifdef HAVE_FMT_STD_H
#include <fmt/std.h>
#else
namespace fmt {
template <>
struct formatter<fs::path> : formatter<std::string> {};
}
#endif

namespace cs::semantic {

Expand Down

0 comments on commit 0daacf2

Please sign in to comment.