summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Niklas Hasse <jhasse@bixense.com>2023-05-11 09:11:41 +0200
committerGitHub <noreply@github.com>2023-05-11 09:11:41 +0200
commit9a460a9e9b083fc32db7aa6697c8bc3366c524b8 (patch)
treef9b131f4e6ff417f90bbc09b1845ca88c8f56109
parentadf9bddd73869084a505fac83246e55c35880079 (diff)
parent3d1b382f626ef72187adbc68ad4a5c64afd5f513 (diff)
downloadninja-master.tar.gz
Merge pull request #2293 from digit-google/fix-ppoll-auto-detectionHEADmaster
CMakeLists: Fix ppoll() feature detection.
-rw-r--r--CMakeLists.txt12
1 files changed, 10 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fd32ab1..ac62a49 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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()