From 2ebcb451a538dbae74ee356bafd630bf74cf81be Mon Sep 17 00:00:00 2001 From: Alex Hirsch Date: Sat, 7 Dec 2024 10:38:16 +0100 Subject: [PATCH] Include only if FMT_CPP_LIB_FILESYSTEM is set This change results out of necessity since the Nintendo Switch console SDK does not support `std::filesystem`. The SDK still provides the `` header, but with an `#error` directive, effectively breaking any build that includes `` Because `` is present, `FMT_HAS_INCLUDE` is insufficient here. With this change and `FMT_CPP_LIB_FILESYSTEM` in place, one can define `FMT_CPP_LIB_FILESYSTEM=0` to work around this issue. This assumes that `` can be included (without warnings) if `FMT_CPP_LIB_FILESYSTEM` is set. If this is not the case, fmt would be broken even before this change as `std::filesystem::path` is used without the accompanying header. --- include/fmt/std.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/fmt/std.h b/include/fmt/std.h index 839e17142f5b..82fa5278d038 100644 --- a/include/fmt/std.h +++ b/include/fmt/std.h @@ -27,9 +27,6 @@ // Check FMT_CPLUSPLUS to suppress a bogus warning in MSVC. # if FMT_CPLUSPLUS >= 201703L -# if FMT_HAS_INCLUDE() -# include -# endif # if FMT_HAS_INCLUDE() # include # endif @@ -79,6 +76,7 @@ #endif #if FMT_CPP_LIB_FILESYSTEM +# include FMT_BEGIN_NAMESPACE namespace detail {