Fix fcloseall not defined on some platform

This commit is contained in:
2022-05-31 00:32:31 +00:00
committed by GitHub
parent 3a02cfa641
commit 976582828b
4 changed files with 12 additions and 1 deletions

View File

@@ -50,6 +50,13 @@ check_symbol_exists(strerror_r "string.h" HAVE_STRERROR_R)
if (HAVE_STRERROR_R)
test_strerror_r(HAVE_GNU_STRERROR_R)
endif()
if (NOT WIN32)
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
check_symbol_exists(fcloseall "stdio.h" HAVE_FCLOSEALL)
if (HAVE_FCLOSEALL)
add_compile_definitions(_GNU_SOURCE)
endif()
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/utils_config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/utils_config.h")
if (${CMAKE_C_COMPILER_ID} STREQUAL GNU)