diff options
-rw-r--r-- | CMakeLists.txt | 12 |
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() |