Skip to content

Commit

Permalink
Don't include fmt/os.h in the module if it is disabled via FMT_OS
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Jan 1, 2024
1 parent 5837294 commit c54c2c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ option(FMT_INSTALL "Generate the install target." ON)
option(FMT_TEST "Generate the test target." ${FMT_MASTER_PROJECT})
option(FMT_FUZZ "Generate the fuzz target." OFF)
option(FMT_CUDA_TEST "Generate the cuda-test target." OFF)
option(FMT_OS "Include core requiring OS (Windows/Posix) " ON)
option(FMT_OS "Include OS-specific APIs." ON)
option(FMT_MODULE "Build a module instead of a traditional library." OFF)
option(FMT_SYSTEM_HEADERS "Expose headers with marking them as system." OFF)

Expand Down Expand Up @@ -280,6 +280,7 @@ add_headers(FMT_HEADERS args.h chrono.h color.h compile.h core.h format.h
set(FMT_SOURCES src/format.cc)
if (FMT_OS)
set(FMT_SOURCES ${FMT_SOURCES} src/os.cc)
target_compile_definitions(fmt PRIVATE FMT_OS=0)
endif ()

add_module_library(fmt src/fmt.cc FALLBACK
Expand Down
4 changes: 3 additions & 1 deletion src/fmt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ extern "C++" {
#include "fmt/color.h"
#include "fmt/compile.h"
#include "fmt/format.h"
#include "fmt/os.h"
#if !defined(FMT_OS) || FMT_OS
# include "fmt/os.h"
#endif
#include "fmt/printf.h"
#include "fmt/std.h"
#include "fmt/xchar.h"
Expand Down

0 comments on commit c54c2c5

Please sign in to comment.