diff --git a/CMakeLists.txt b/CMakeLists.txt index 0898e5bd..f14a49c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,6 +63,8 @@ function(add_module_library name) target_compile_options(${name} PUBLIC -fmodules-ts) endif () + target_compile_definitions(${name} PRIVATE FMT_MODULE) + if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.28 AND CMAKE_GENERATOR STREQUAL "Ninja") target_sources(${name} PUBLIC FILE_SET fmt TYPE CXX_MODULES FILES ${sources}) else() diff --git a/include/fmt/base.h b/include/fmt/base.h index 6b1d8140..2e10a4c3 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -8,9 +8,12 @@ #ifndef FMT_BASE_H_ #define FMT_BASE_H_ -#include // CHAR_BIT -#include // FILE -#include // strlen +// c headers are preferable for performance reasons +#ifndef FMT_MODULE +# include // CHAR_BIT +# include // FILE +# include // strlen +#endif #ifndef FMT_IMPORT_STD // is also included transitively from . diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index f47f1758..77d04032 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -2144,8 +2144,7 @@ struct formatter : private formatter { if (use_tm_formatter_) return formatter::format(time, ctx); detail::get_locale loc(false, ctx.locale()); auto w = detail::tm_writer(loc, ctx.out(), time); - w.on_day_of_month(detail::numeric_system::standard, - detail::pad_type::zero); + w.on_day_of_month(detail::numeric_system::standard, detail::pad_type::zero); return w.out(); } }; diff --git a/src/fmt.cc b/src/fmt.cc index bb3845f2..b7e5ccd4 100644 --- a/src/fmt.cc +++ b/src/fmt.cc @@ -6,6 +6,7 @@ module; # include # include # include +# include # include # include # include @@ -13,6 +14,7 @@ module; # include # include # include +# include # include # include # include @@ -22,6 +24,7 @@ module; # include # include # include +# include # include # include # include @@ -104,7 +107,9 @@ extern "C++" { #if FMT_OS # include "fmt/os.h" #endif +#include "fmt/ostream.h" #include "fmt/printf.h" +#include "fmt/ranges.h" #include "fmt/std.h" #include "fmt/xchar.h"