Skip to content

Commit 04614d4

Browse files
authored
Update fmt package to 9.1.0 (#683)
1 parent 658f9b2 commit 04614d4

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

cmake/configs/default.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ hunter_default_version(filament VERSION 1.9.8)
282282
hunter_default_version(fixesproto VERSION 5.0)
283283
hunter_default_version(flatbuffers VERSION 2.0.0)
284284
hunter_default_version(flex VERSION 2.6.4)
285-
hunter_default_version(fmt VERSION 8.1.1)
285+
hunter_default_version(fmt VERSION 9.1.0)
286286
hunter_default_version(folly VERSION 2018.10.22.00-p4)
287287
hunter_default_version(freetype VERSION 2.10.4-p0)
288288
hunter_default_version(freetype-gl VERSION 0.0.0-1a8c007-p0)

cmake/projects/fmt/hunter.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,17 @@ hunter_add_version(
129129
9577d6de8f4e268690b099976810ade9ebef5fb5
130130
)
131131

132+
hunter_add_version(
133+
PACKAGE_NAME
134+
fmt
135+
VERSION
136+
"9.1.0"
137+
URL
138+
"https://github.com/fmtlib/fmt/archive/9.1.0.tar.gz"
139+
SHA1
140+
6c0db60f3fa7bd4cf58edc777a2408e0ddfb28b9
141+
)
142+
132143
hunter_cmake_args(
133144
fmt
134145
CMAKE_ARGS

examples/fmt/fmtexample.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#include <fmt/format.h>
2-
#include <fmt/core.h>
1+
#include <fmt/format.h> // The full format API. Lightweight subset of formatting functions is fmt/core.h
32

43
int main() {
54
fmt::print("Hello world\nThis is fmt(ex-cppformat)\n");
65
std::string as_string = fmt::format("The answer is {}", 42);
7-
fmt::memory_buffer buf;
8-
format_to(buf, "{}\nThe previous line and this message were bufferred in memory", as_string);
9-
fmt::print(stderr, "{}\nAnd then were printed to stderr\n", buf.data());
6+
auto buf = fmt::memory_buffer();
7+
fmt::format_to(std::back_inserter(buf), "{}\nThe previous line and this message were bufferred in memory", as_string);
8+
// We can not use buf.data() directly. To convert buffer to string use fmt::to_string(buf). It uses buf.size() to determine correct string size!!!
9+
fmt::print(stderr, "{}\nAnd then were printed to stderr\n", fmt::to_string(buf));
1010
fmt::print("Fmt supports many nice features, see {url} for details\n", fmt::arg("url", "https://github.com/fmtlib/fmt"));
1111
}

0 commit comments

Comments
 (0)