File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ endif ()
128128list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /support/cmake" )
129129
130130include (CheckCXXCompilerFlag )
131+ include (CheckCXXSourceCompiles )
131132include (JoinPaths )
132133
133134if (FMT_MASTER_PROJECT AND NOT DEFINED CMAKE_CXX_VISIBILITY_PRESET)
@@ -307,6 +308,18 @@ else ()
307308 message (WARNING "Feature cxx_std_11 is unknown for the CXX compiler" )
308309endif ()
309310
311+ check_cxx_source_compiles ([[
312+ #include <stdio.h>
313+ int main() {
314+ // Use stdout just to prove we can pass a FILE* to it
315+ flockfile(stdout);
316+ funlockfile(stdout);
317+ return 0;
318+ }
319+ ]] HAVE_FLOCKFILE_COMPILE_TEST )
320+ target_compile_definitions (fmt PRIVATE
321+ FMT_HAVE_FLOCKFILE_COMPILE_TEST=$<BOOL:HAVE_FLOCKFILE_COMPILE_TEST> )
322+
310323# Set FMT_LIB_NAME for pkg-config fmt.pc. We cannot use the OUTPUT_NAME target
311324# property because it's not set by default.
312325set (FMT_LIB_NAME fmt)
Original file line number Diff line number Diff line change @@ -1490,7 +1490,11 @@ template <typename F> auto getc_unlocked(F* f) -> decltype(_fgetc_nolock(f)) {
14901490#endif
14911491
14921492#ifndef FMT_USE_FLOCKFILE
1493- # define FMT_USE_FLOCKFILE 1
1493+ # ifdef FMT_HAVE_FLOCKFILE_COMPILE_TEST
1494+ # define FMT_USE_FLOCKFILE FMT_HAVE_FLOCKFILE_COMPILE_TEST
1495+ # else
1496+ # define FMT_USE_FLOCKFILE 1
1497+ # endif
14941498#endif
14951499
14961500template <typename F = FILE, typename Enable = void >
You can’t perform that action at this time.
0 commit comments