#3399 broke compatibility with all versions of libfmt prior to 11.2.0
Here: https://github.com/gabime/spdlog/pull/3399/files#diff-1d7d4c9d189a244df358d2005ee7bfc62368dedfce736cd162ecad07dd399416L28-R28
fmt/base.h does not exist in older versions of libfmt. There should be a check in here.
This could not be done by normal version checks, since FMT_VERSION is defined in fmt/base.h (or previously fmt/core.h) itself.
I would suggest something like:
#if __has_include(<fmt/base.h>)
#include <fmt/base.h>
#elif __has_include(<fmt/core.h>)
#include <fmt/core.h>
#else
#error "no compatible fmtlib header found!"
#endif
FYI, __has_include extension is supported by GCC, Clang and (recent) MSVC.
Oh, that's nasty.
Maybe I should post about this upstream as well?
__has_include is only cpp 17+
@gabime It is standardized in C++17, but was added in GCC / Clang quote a long time ago (at least GCC 5).
It seems the correct workaround is to just include core.h which was re-added as a stub to include format.h (not sure why not just base.h though)
@gabime It is standardized in C++17, but was added in GCC / Clang quote a long time ago (at least GCC 5).
Yeah, google shows it being present in GCC docs at least as far back as 2012.
Still not ideal, but IMO it's either that or blanket including core.h.
Yeah, google shows it being present in GCC docs at least as far back as 2012.
But msvc doesn't offer this in earlier version afaik.
Lets try to ask the fmt author. @vitaut, what would be the recommended fix? to include core.h if fmt version is lower than 11.2.0 ?
The code already includes fmt/format.h so including fmt/core.h or fmt/base.h is redundant - those only provide a subset of the API. I suggest simply removing those includes.