From 7a2b7af5626f247a06bb4f01b6d943c8c2e174dd Mon Sep 17 00:00:00 2001 From: guoliang <648100535@qq.com> Date: Fri, 10 Oct 2025 23:42:51 +0800 Subject: [PATCH 1/5] [fix] #4565 When using MSVC to compile v12.0.0, many compilation warnings are generated --- include/fmt/format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index c3a1bda0..abab9681 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2506,7 +2506,7 @@ FMT_CONSTEXPR20 auto write_fixed(OutputIt out, const DecimalFP& f, auto grouping = Grouping(loc, specs.localized()); size += grouping.count_separators(exp); return write_padded( - out, specs, to_unsigned(size), [&](iterator it) { + out, specs, to_unsigned(static_cast(size)), [&](iterator it) { if (s != sign::none) *it++ = detail::getsign(s); it = write_significand(it, f.significand, significand_size, f.exponent, grouping); From 91ec31bc319873b0e2cef385fb20848e737f30ca Mon Sep 17 00:00:00 2001 From: guoliang <648100535@qq.com> Date: Fri, 10 Oct 2025 23:42:51 +0800 Subject: [PATCH 2/5] [fix] #4565 When using MSVC to compile v12.0.0, many compilation warnings are generated --- include/fmt/format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index c3a1bda0..be4bc215 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2506,7 +2506,7 @@ FMT_CONSTEXPR20 auto write_fixed(OutputIt out, const DecimalFP& f, auto grouping = Grouping(loc, specs.localized()); size += grouping.count_separators(exp); return write_padded( - out, specs, to_unsigned(size), [&](iterator it) { + out, specs, tatic_cast(size), [&](iterator it) { if (s != sign::none) *it++ = detail::getsign(s); it = write_significand(it, f.significand, significand_size, f.exponent, grouping); From 9dd354f7210ff3d80898bd32822d4c0caa9949a1 Mon Sep 17 00:00:00 2001 From: guoliang <648100535@qq.com> Date: Fri, 10 Oct 2025 23:42:51 +0800 Subject: [PATCH 3/5] [fix] #4565 When using MSVC to compile v12.0.0, many compilation warnings are generated --- include/fmt/format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index c3a1bda0..abdd2ada 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2506,7 +2506,7 @@ FMT_CONSTEXPR20 auto write_fixed(OutputIt out, const DecimalFP& f, auto grouping = Grouping(loc, specs.localized()); size += grouping.count_separators(exp); return write_padded( - out, specs, to_unsigned(size), [&](iterator it) { + out, specs, static_cast(size), [&](iterator it) { if (s != sign::none) *it++ = detail::getsign(s); it = write_significand(it, f.significand, significand_size, f.exponent, grouping); From 452dd2b9f85811efc40a072959be189a2e673aee Mon Sep 17 00:00:00 2001 From: guoliang <648100535@qq.com> Date: Fri, 17 Oct 2025 21:57:01 +0800 Subject: [PATCH 4/5] [fix] error: module file CMakeFiles/__cmake_cxx23.dir/std.pcm cannot be loaded due to a configuration mismatch with the current compilation #4279 --- CMakeLists.txt | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c055132..c070d3ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,6 +81,15 @@ function(add_module_library name) # `std` is affected by CMake options and may be higher than C++20. get_target_property(std ${name} CXX_STANDARD) + # Respect CMAKE_CXX_EXTENSIONS when forming the -std flag used to + # precompile modules. A mismatch between -std=gnu++ and -std=c++ + # can cause "configuration mismatch" errors when loading .pcm files. + if (CMAKE_CXX_EXTENSIONS) + set(std_flag "-std=gnu++${std}") + else() + set(std_flag "-std=c++${std}") + endif() + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(pcms) foreach (src ${sources}) @@ -94,15 +103,15 @@ function(add_module_library name) # Use an absolute path to prevent target_link_libraries prepending -l # to it. set(pcms ${pcms} ${CMAKE_CURRENT_BINARY_DIR}/${pcm}) - add_custom_command( - OUTPUT ${pcm} - COMMAND ${CMAKE_CXX_COMPILER} - -std=c++${std} -x c++-module --precompile -c - -o ${pcm} ${CMAKE_CURRENT_SOURCE_DIR}/${src} - "-I$,;-I>" - # Required by the -I generator expression above. - COMMAND_EXPAND_LISTS - DEPENDS ${src}) + add_custom_command( + OUTPUT ${pcm} + COMMAND ${CMAKE_CXX_COMPILER} + ${std_flag} -x c++-module --precompile -c + -o ${pcm} ${CMAKE_CURRENT_SOURCE_DIR}/${src} + "-I$,;-I>" + # Required by the -I generator expression above. + COMMAND_EXPAND_LISTS + DEPENDS ${src}) endforeach () # Add .pcm files as sources to make sure they are built before the library. @@ -112,11 +121,12 @@ function(add_module_library name) set(obj ${pcm_we}.o) # Use an absolute path to prevent target_link_libraries prepending -l. set(sources ${sources} ${pcm} ${CMAKE_CURRENT_BINARY_DIR}/${obj}) - add_custom_command( - OUTPUT ${obj} - COMMAND ${CMAKE_CXX_COMPILER} $ - -c -o ${obj} ${pcm} - DEPENDS ${pcm}) + add_custom_command( + OUTPUT ${obj} + COMMAND ${CMAKE_CXX_COMPILER} ${std_flag} -c -o ${obj} ${pcm} + "-I$,;-I>" + COMMAND_EXPAND_LISTS + DEPENDS ${pcm}) endforeach () endif () target_sources(${name} PRIVATE ${sources}) From 1efafcb9bdf304ba02169e1d7e067d6944313550 Mon Sep 17 00:00:00 2001 From: guoliang <648100535@qq.com> Date: Fri, 17 Oct 2025 21:57:01 +0800 Subject: [PATCH 5/5] [fix] error: module file CMakeFiles/__cmake_cxx23.dir/std.pcm cannot be loaded due to a configuration mismatch with the current compilation #4279 --- CMakeLists.txt | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c055132..c639548c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,6 +81,15 @@ function(add_module_library name) # `std` is affected by CMake options and may be higher than C++20. get_target_property(std ${name} CXX_STANDARD) + # Respect CMAKE_CXX_EXTENSIONS when forming the -std flag used to + # precompile modules. A mismatch between -std=gnu++ and -std=c++ + # can cause "configuration mismatch" errors when loading .pcm files. + if (CMAKE_CXX_EXTENSIONS) + set(std_flag "-std=gnu++${std}") + else() + set(std_flag "-std=c++${std}") + endif() + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(pcms) foreach (src ${sources}) @@ -97,9 +106,9 @@ function(add_module_library name) add_custom_command( OUTPUT ${pcm} COMMAND ${CMAKE_CXX_COMPILER} - -std=c++${std} -x c++-module --precompile -c - -o ${pcm} ${CMAKE_CURRENT_SOURCE_DIR}/${src} - "-I$,;-I>" + ${std_flag} -x c++-module --precompile -c + -o ${pcm} ${CMAKE_CURRENT_SOURCE_DIR}/${src} + "-I$,;-I>" # Required by the -I generator expression above. COMMAND_EXPAND_LISTS DEPENDS ${src}) @@ -112,11 +121,12 @@ function(add_module_library name) set(obj ${pcm_we}.o) # Use an absolute path to prevent target_link_libraries prepending -l. set(sources ${sources} ${pcm} ${CMAKE_CURRENT_BINARY_DIR}/${obj}) - add_custom_command( - OUTPUT ${obj} - COMMAND ${CMAKE_CXX_COMPILER} $ - -c -o ${obj} ${pcm} - DEPENDS ${pcm}) + add_custom_command( + OUTPUT ${obj} + COMMAND ${CMAKE_CXX_COMPILER} ${std_flag} -c -o ${obj} ${pcm} + "-I$,;-I>" + COMMAND_EXPAND_LISTS + DEPENDS ${pcm}) endforeach () endif () target_sources(${name} PRIVATE ${sources})