From: Azat Khuzhin Date: Sun, 5 Mar 2017 21:30:21 +0000 (+0300) Subject: cmake: detect _GNU_SOURCE not by __GNU_LIBRARY__ only (fallback to _GNU_SOURCE) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=71a56bd3a7f4f74ded331fdd4156b680c7e2fc9b;p=libevent cmake: detect _GNU_SOURCE not by __GNU_LIBRARY__ only (fallback to _GNU_SOURCE) Fixes pipe2() on Android-9/armv7-a Refs: #475 --- 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)