Skip to content

Commit

Permalink
Merge pull request #2293 from digit-google/fix-ppoll-auto-detection
Browse files Browse the repository at this point in the history
CMakeLists: Fix ppoll() feature detection.
  • Loading branch information
jhasse authored May 11, 2023
2 parents adf9bdd + 3d1b382 commit 9a460a9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,16 @@ else()
if(NOT NINJA_FORCE_PSELECT)
# Check whether ppoll() is usable on the target platform.
# Set -DUSE_PPOLL=1 if this is the case.
include(CheckSymbolExists)
check_symbol_exists(ppoll poll.h HAVE_PPOLL)
#
# NOTE: Use check_cxx_symbol_exists() instead of check_symbol_exists()
# because on Linux, <poll.h> only exposes the symbol when _GNU_SOURCE
# is defined.
#
# Both g++ and clang++ define the symbol by default, because the C++
# standard library headers require it, but *not* gcc and clang, which
# are used by check_symbol_exists().
include(CheckCXXSymbolExists)
check_cxx_symbol_exists(ppoll poll.h HAVE_PPOLL)
if(HAVE_PPOLL)
add_compile_definitions(USE_PPOLL=1)
endif()
Expand Down

0 comments on commit 9a460a9

Please sign in to comment.