Skip to content

Commit

Permalink
[libfmt] Require libfmt-7.1.0 or later in order to use a system-wide …
Browse files Browse the repository at this point in the history
…version.

- libfmt-6.2.0: Introduced the 'L' format specifier.
  - Previously, 'n' was available.
  - The 'L' specifier matches C++20 std::format().
- libfmt-7.0.x: Has fixes for the 'L' format specifier; removed 'n'.
  - 'n' can be re-enabled with FMT_DEPRECATED_N_SPECIFIER.
- libfmt-7.1.0: Has more fixes for the 'L' format specifier.
- libfmt-8.0.0: Removes the 'n' format specifier entirely.

Since we use the 'L' specifier, we will set a minimum of libfmt-7.1.0.
Ubuntu 20.04 has libfmt-6.1.2; Ubuntu 22.04 has libfmt-8.1.1.
Also, Ubuntu 20.04's libfmt is a static library. It was changed
to a shared library sometime between 20.04 and 22.04.

rp-libfmt.h: Removed macros for compatibility with versions of libfmt
older than 7.1.0.
  • Loading branch information
GerbilSoft committed Jan 24, 2025
1 parent 5f26028 commit adb4dff
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmake/libs/CheckLibfmt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,19 @@ IF(NOT USE_INTERNAL_FMT)
ENDIF()

# Check for libfmt.
FIND_PACKAGE(Fmt)
# - libfmt-6.2.0: Introduced the 'L' format specifier.
# - Previously, 'n' was available.
# - The 'L' specifier matches C++20 std::format().
# - libfmt-7.0.x: Has fixes for the 'L' format specifier; removed 'n'.
# - 'n' can be re-enabled with FMT_DEPRECATED_N_SPECIFIER.
# - libfmt-7.1.0: Has more fixes for the 'L' format specifier.
# - libfmt-8.0.0: Removes the 'n' format specifier entirely.
#
# Since we use the 'L' specifier, we will set a minimum of libfmt-7.1.0.
# Ubuntu 20.04 has libfmt-6.1.2; Ubuntu 22.04 has libfmt-8.1.1.
# Also, Ubuntu 20.04's libfmt is a static library. It was changed
# to a shared library sometime between 20.04 and 22.04.
FIND_PACKAGE(Fmt 7.1.0)
IF(Fmt_FOUND)
# Found system libfmt.
SET(HAVE_Fmt 1)
Expand Down

0 comments on commit adb4dff

Please sign in to comment.