Skip to content

Commit

Permalink
Fix mmap() C API detection on macOS
Browse files Browse the repository at this point in the history
The CheckFmapFeatures module is failing because HAVE_SYS_STAT_H and
HAVE_SYS_TYPES_H are not defined within the check_c_source_compiles
environment.

This commit adds them in the same way as is done for CheckFDPassing
module.
  • Loading branch information
micahsnyder committed Sep 26, 2022
1 parent f720b00 commit 197113c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmake/CheckFmapFeatures.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ include(CheckSymbolExists)
include(CheckFunctionExists)
include(CheckCSourceCompiles)

# Extra -D Compile Definitions for check_c_source_compiles()
set(CMAKE_REQUIRED_DEFINITIONS "")
if(HAVE_SYS_TYPES_H)
set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS};-DHAVE_SYS_TYPES_H=1")
endif()
if(HAVE_SYS_STAT_H)
set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS};-DHAVE_SYS_STAT_H=1")
endif()

# Check for mmap() support, required for HAVE_MPOOL.
#
# checks for private fixed mappings, we don't need fixed mappings,
Expand Down

0 comments on commit 197113c

Please sign in to comment.