From 81b3d3822d19a0c1dbd65d04f24d92b31ea7022a Mon Sep 17 00:00:00 2001 From: Krzysztof Wesolowski Date: Thu, 30 Apr 2020 11:25:39 +0200 Subject: [PATCH] Allow to avoid inclusion of os.cc in fmt target Allows to avoid part of #1654 --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 29b9dd58539a5..0ce38e7b8adb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,7 @@ option(FMT_INSTALL "Generate the install target." ${MASTER_PROJECT}) option(FMT_TEST "Generate the test target." ${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) project(FMT CXX) # Get version from core.h @@ -173,7 +173,11 @@ endfunction() # Define the fmt library, its includes and the needed defines. add_headers(FMT_HEADERS chrono.h color.h compile.h core.h format.h format-inl.h locale.h os.h ostream.h posix.h printf.h ranges.h) -set(FMT_SOURCES src/format.cc src/os.cc) +if (FMT_OS) + set(FMT_SOURCES src/format.cc src/os.cc) +else() + set(FMT_SOURCES src/format.cc) +endif () add_library(fmt ${FMT_SOURCES} ${FMT_HEADERS} README.rst ChangeLog.rst) add_library(fmt::fmt ALIAS fmt)