summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Niklas Hasse <jhasse@bixense.com>2023-04-21 19:42:09 +0200
committerGitHub <noreply@github.com>2023-04-21 19:42:09 +0200
commita660b3e67f32e1d1bdf612a11f3fb77a57a60928 (patch)
tree2f6c9828e6938af8f4ba587a72582733cb7c74ee
parentc266b21674171dfb39d10872bec6ac493665cc5d (diff)
parent63415a419815d844149557aa16fa8a0f72b0c7e6 (diff)
downloadninja-a660b3e67f32e1d1bdf612a11f3fb77a57a60928.tar.gz
Merge pull request #2290 from digit-google/use-ppoll
Enable ppoll() usage when available.
-rw-r--r--CMakeLists.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 98f7948..fd32ab1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,6 +4,7 @@ include(CheckSymbolExists)
include(CheckIPOSupported)
option(NINJA_BUILD_BINARY "Build ninja binary" ON)
+option(NINJA_FORCE_PSELECT "Use pselect() even on platforms that provide ppoll()" OFF)
project(ninja CXX)
@@ -35,6 +36,16 @@ else()
if(flag_color_diag)
add_compile_options(-fdiagnostics-color)
endif()
+
+ 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)
+ if(HAVE_PPOLL)
+ add_compile_definitions(USE_PPOLL=1)
+ endif()
+ endif()
endif()
# --- optional re2c