Merge 7605e0ba7c9fab062b89ff15678567c6bbeea5f4 into eeff8680ed900933c28df7c618ca3e11d6a766ec

This commit is contained in:
Mike Vastola 2026-04-23 16:31:11 -04:00 committed by GitHub
commit 6bd4bd77f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View File

@ -128,6 +128,7 @@ endif ()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/support/cmake")
include(CheckCXXCompilerFlag)
include(CheckCXXSourceCompiles)
include(JoinPaths)
if (FMT_MASTER_PROJECT AND NOT DEFINED CMAKE_CXX_VISIBILITY_PRESET)
@ -307,6 +308,21 @@ else ()
message(WARNING "Feature cxx_std_11 is unknown for the CXX compiler")
endif ()
check_cxx_source_compiles(
[[
#include <stdio.h>
int main() {
// Use stdout just to prove we can pass a FILE* to it
flockfile(stdout);
funlockfile(stdout);
return 0;
}
]]
HAVE_FLOCKFILE_COMPILE_TEST)
target_compile_definitions(
fmt
PRIVATE FMT_HAVE_FLOCKFILE_COMPILE_TEST=$<BOOL:HAVE_FLOCKFILE_COMPILE_TEST>)
# Set FMT_LIB_NAME for pkg-config fmt.pc. We cannot use the OUTPUT_NAME target
# property because it's not set by default.
set(FMT_LIB_NAME fmt)

View File

@ -1490,7 +1490,11 @@ template <typename F> auto getc_unlocked(F* f) -> decltype(_fgetc_nolock(f)) {
#endif
#ifndef FMT_USE_FLOCKFILE
# define FMT_USE_FLOCKFILE 1
# ifdef FMT_HAVE_FLOCKFILE_COMPILE_TEST
# define FMT_USE_FLOCKFILE FMT_HAVE_FLOCKFILE_COMPILE_TEST
# else
# define FMT_USE_FLOCKFILE 1
# endif
#endif
template <typename F = FILE, typename Enable = void>