diff --git a/libc/src/stdio/printf_core/CMakeLists.txt b/libc/src/stdio/printf_core/CMakeLists.txt --- a/libc/src/stdio/printf_core/CMakeLists.txt +++ b/libc/src/stdio/printf_core/CMakeLists.txt @@ -31,17 +31,6 @@ .core_structs ) -add_object_library( - file_writer - SRCS - file_writer.cpp - HDRS - file_writer.h - DEPENDS - libc.src.__support.File.file - .core_structs -) - add_object_library( writer SRCS @@ -91,6 +80,23 @@ libc.src.__support.arg_list ) +if(NOT (TARGET libc.src.__support.File.file)) + # Not all platforms have a file implementation. If file is unvailable, + # then we must skip all file based printf sections. + return() +endif() + +add_object_library( + file_writer + SRCS + file_writer.cpp + HDRS + file_writer.h + DEPENDS + libc.src.__support.File.file + .core_structs +) + add_object_library( vfprintf_internal SRCS