From 71a56bd3a7f4f74ded331fdd4156b680c7e2fc9b Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 6 Mar 2017 00:30:21 +0300 Subject: [PATCH] cmake: detect _GNU_SOURCE not by __GNU_LIBRARY__ only (fallback to _GNU_SOURCE) Fixes pipe2() on Android-9/armv7-a Refs: #475 --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1eabc243..a861e7d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -224,7 +224,14 @@ if (SOLARIS) endif() # Check if _GNU_SOURCE is available. -CHECK_SYMBOL_EXISTS(__GNU_LIBRARY__ "features.h" _GNU_SOURCE) +if (NOT _GNU_SOURCE) + CHECK_SYMBOL_EXISTS(__GNU_LIBRARY__ "features.h" _GNU_SOURCE) + + if (NOT _GNU_SOURCE) + unset(_GNU_SOURCE CACHE) + CHECK_SYMBOL_EXISTS(_GNU_SOURCE "features.h" _GNU_SOURCE) + endif() +endif() if (_GNU_SOURCE) add_definitions(-D_GNU_SOURCE) -- 2.50.1