diff --git a/ChangeLog.md b/ChangeLog.md index 5657acb16530..dc54ecfcbb88 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -15,6 +15,10 @@ `fmt::ostream_formatter`) and `fmt::streamed` from the C++20 module (https://github.com/fmtlib/fmt/pull/4861). Thanks @avikivity. +- Documented how to use the C++20 module with CMake, including the + `fmt::fmt-module` target and compiler requirements + (https://github.com/fmtlib/fmt/issues/4237). + - Optimized 128-bit integer formatting by reducing the value to 64-bit chunks instead of doing repeated 128-bit division, giving a ~5x speedup on full-range values. diff --git a/doc/get-started.md b/doc/get-started.md index c37d4139940d..804dd0127bf8 100644 --- a/doc/get-started.md +++ b/doc/get-started.md @@ -47,6 +47,22 @@ In order to use the header-only target or the module target, simply substitute t `fmt::fmt` in the above steps with `fmt::fmt-header-only` or `fmt::fmt-module` accordingly. +### Using the C++20 Module + +Link your target to `fmt::fmt-module` and import `fmt` instead of including a +{fmt} header: + + target_link_libraries( PRIVATE fmt::fmt-module) + + import fmt; + + int main() { + fmt::print("Hello, world!\\n"); + } + +The module target requires C++20 module support in CMake and the compiler. For +GCC, use CMake 3.28 or newer, Ninja 1.11 or newer, and GCC 15 or newer. + ## Installation ### Debian/Ubuntu