mirror of
https://github.com/transmission/transmission.git
synced 2026-05-08 09:39:08 +01:00
fb25228f24
* chore: bump fmt to 11.2.0 Acquire https://github.com/fmtlib/fmt/commit/6797f0c39a4ef13061cbc3bb850c35af7428fdc4, which fixes compile error on GCC 15.1. Acquire https://github.com/fmtlib/fmt/commit/9f269062a7ba1440d91c12f096a8cf3b91d6fbe9, 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`
22 lines
921 B
CMake
22 lines
921 B
CMake
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
|
|
${${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
|
|
$<IF:$<VERSION_GREATER_EQUAL:${${CMAKE_FIND_PACKAGE_NAME}_VERSION},11.2.0>,FMT_USE_EXCEPTIONS,FMT_EXCEPTIONS>=0
|
|
FMT_HEADER_ONLY=1)
|