diff --git a/CMakeLists.txt b/CMakeLists.txt index 059b15023845..c28ff071b352 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,8 +69,6 @@ function(add_module_library name) target_compile_options(${name} PUBLIC -fmodules-ts) endif () - target_compile_definitions(${name} PRIVATE FMT_MODULE) - if (FMT_USE_CMAKE_MODULES) target_sources(${name} PUBLIC FILE_SET fmt TYPE CXX_MODULES FILES ${sources}) diff --git a/include/fmt/base.h b/include/fmt/base.h index c1d09c6d4712..b832e5348226 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -299,7 +299,7 @@ // Enable minimal optimizations for more compact code in debug mode. FMT_PRAGMA_GCC(push_options) -#if !defined(__OPTIMIZE__) && !defined(__CUDACC__) +#if !defined(__OPTIMIZE__) && !defined(__CUDACC__) && !defined(FMT_MODULE) FMT_PRAGMA_GCC(optimize("Og")) #endif FMT_PRAGMA_CLANG(diagnostic push) diff --git a/src/fmt.cc b/src/fmt.cc index 2dc4ef2f64d9..671fd69589eb 100644 --- a/src/fmt.cc +++ b/src/fmt.cc @@ -1,5 +1,7 @@ module; +#define FMT_MODULE + #ifdef _MSVC_LANG # define FMT_CPLUSPLUS _MSVC_LANG #else