From 9600fee020e4166d31adf3e90489acf9625bde02 Mon Sep 17 00:00:00 2001 From: Alex Hirsch <328798+W4RH4WK@users.noreply.github.com> Date: Sat, 7 Dec 2024 15:45:54 +0100 Subject: [PATCH] Include only if FMT_CPP_LIB_FILESYSTEM is set (#4258) 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 839e1714..82fa5278 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 {