summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Niklas Hasse <jhasse@bixense.com>2021-06-04 13:48:58 (GMT)
committerGitHub <noreply@github.com>2021-06-04 13:48:58 (GMT)
commit8fa4d05fea5140f80ff5f4629d19c6ce0d6f5cca (patch)
treed990081cce424f283109f6445a8536aaf12a3dd8
parentc573f6b8b23593f46a08616b76325d3ce0175002 (diff)
parent54c5759471895f820735c232c36e81af96201912 (diff)
downloadNinja-8fa4d05fea5140f80ff5f4629d19c6ce0d6f5cca.zip
Ninja-8fa4d05fea5140f80ff5f4629d19c6ce0d6f5cca.tar.gz
Ninja-8fa4d05fea5140f80ff5f4629d19c6ce0d6f5cca.tar.bz2
Merge pull request #1977 from mathstuf/cross-compilation-browse
cmake: use `check_symbol_exists` for browse support
-rw-r--r--CMakeLists.txt15
1 files changed, 10 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8de69e8..bc02c4d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.15)
-include(CheckIncludeFileCXX)
+include(CheckSymbolExists)
include(CheckIPOSupported)
project(ninja)
@@ -73,10 +73,15 @@ function(check_platform_supports_browse_mode RESULT)
endif()
# Now check availability of the unistd header
- check_include_file_cxx(unistd.h PLATFORM_HAS_UNISTD_HEADER)
- set(${RESULT} "${PLATFORM_HAS_UNISTD_HEADER}" PARENT_SCOPE)
- if(NOT PLATFORM_HAS_UNISTD_HEADER)
- message(WARNING "browse feature omitted due to missing unistd.h")
+ check_symbol_exists(fork "unistd.h" HAVE_FORK)
+ check_symbol_exists(pipe "unistd.h" HAVE_PIPE)
+ set(browse_supported 0)
+ if (HAVE_FORK AND HAVE_PIPE)
+ set(browse_supported 1)
+ endif ()
+ set(${RESULT} "${browse_supported}" PARENT_SCOPE)
+ if(NOT browse_supported)
+ message(WARNING "browse feature omitted due to missing `fork` and `pipe` functions")
endif()
endfunction()