mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 02:18:42 +00:00
chore: bump {fmt} to 11.2.0 and fix compatibility (#7612)
* chore: bump fmt to 11.2.0 Acquire6797f0c39a, which fixes compile error on GCC 15.1. Acquire9f269062a7, which fixes buffer overflow in NetBSD 10.1 on GCC 10.5. Replace `fmt::localtime` with `std::localtime`, as `fmt::` is now deprecated. * fix: format timezone ourselves on Windows {fmt} 11.2.0 removed the ability to format `std::tm` with the format specifier `%z` on Windows, for a good reason. Ref: https://github.com/fmtlib/fmt/issues/4444 This forces us to implement our own solution on Windows as there's no alternative. * fix: support `FMT_USE_EXCEPTIONS`
This commit is contained in:
@@ -1,10 +1,21 @@
|
||||
add_library(fmt::fmt-header-only INTERFACE IMPORTED)
|
||||
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE "${TR_THIRD_PARTY_SOURCE_DIR}/fmt/include")
|
||||
|
||||
target_include_directories(fmt::fmt-header-only
|
||||
INTERFACE
|
||||
${TR_THIRD_PARTY_SOURCE_DIR}/fmt/include)
|
||||
${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE})
|
||||
|
||||
file(READ "${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE}/fmt/base.h" _FMT_BASE_H)
|
||||
if(_FMT_BASE_H MATCHES "FMT_VERSION ([0-9]+)([0-9][0-9])([0-9][0-9])")
|
||||
# Use math to skip leading zeros if any.
|
||||
math(EXPR _FMT_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
math(EXPR _FMT_VERSION_MINOR ${CMAKE_MATCH_2})
|
||||
math(EXPR _FMT_VERSION_PATCH ${CMAKE_MATCH_3})
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_VERSION "${_FMT_VERSION_MAJOR}.${_FMT_VERSION_MINOR}.${_FMT_VERSION_PATCH}")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(fmt::fmt-header-only
|
||||
INTERFACE
|
||||
FMT_EXCEPTIONS=0
|
||||
$<IF:$<VERSION_GREATER_EQUAL:${${CMAKE_FIND_PACKAGE_NAME}_VERSION},11.2.0>,FMT_USE_EXCEPTIONS,FMT_EXCEPTIONS>=0
|
||||
FMT_HEADER_ONLY=1)
|
||||
|
||||
Reference in New Issue
Block a user