cmake: detect _GNU_SOURCE not by __GNU_LIBRARY__ only (fallback to _GNU_SOURCE)

Fixes pipe2() on Android-9/armv7-a

Refs: #475
This commit is contained in:
Azat Khuzhin 2017-03-06 00:30:21 +03:00
parent 66a4eb0c3a
commit 71a56bd3a7

View File

@ -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)