💚 fix build

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2026-07-01 20:16:12 +02:00
parent 461a9c351b
commit 85e41d06d3
4 changed files with 24 additions and 22 deletions
+15 -1
View File
@@ -195,4 +195,18 @@ add_subdirectory(cmake_add_subdirectory)
add_subdirectory(cmake_fetch_content)
add_subdirectory(cmake_fetch_content2)
add_subdirectory(cmake_target_include_directories)
add_subdirectory(fmt_formatter)
# fmt (fetched by tests/fmt_formatter) requires a genuinely modern, C++17-capable
# toolchain; skip it on legacy/niche toolchains where fmt itself is known not to build
set(JSON_FMT_FORMATTER_TEST_SUPPORTED ${compiler_supports_cpp_17})
# fmt 12's 128-bit integer emulation does not build with 32-bit MinGW
if (MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4)
set(JSON_FMT_FORMATTER_TEST_SUPPORTED FALSE)
endif()
# the MSVC STL rejects Clang versions older than 19 as a host compiler
if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0)
set(JSON_FMT_FORMATTER_TEST_SUPPORTED FALSE)
endif()
if (JSON_FMT_FORMATTER_TEST_SUPPORTED)
add_subdirectory(fmt_formatter)
endif()
+3 -7
View File
@@ -35,11 +35,11 @@ struct fmt::formatter<nlohmann::json>
++it;
}
// ['#'] - "alternate form", used here to request pretty-printing
bool pretty = false;
// ['#'] - "alternate form", used here to request pretty-printing with a
// default indent of 4 (overridden by an explicit width below, if given)
if (it != end && *it == '#')
{
pretty = true;
indent = 4;
++it;
}
@@ -54,10 +54,6 @@ struct fmt::formatter<nlohmann::json>
++it;
}
}
else if (pretty)
{
indent = 4;
}
if (it != end && *it != '}')
{