Fix #294. Add -D_GNU_SOURCE when building under Cygwin

This commit is contained in:
Eric Fiselier 2016-10-08 01:03:23 -06:00
parent 03c4485d84
commit f67ee4ad9b
1 changed files with 8 additions and 0 deletions

View File

@ -91,6 +91,14 @@ else()
cxx_feature_check(THREAD_SAFETY_ATTRIBUTES) cxx_feature_check(THREAD_SAFETY_ATTRIBUTES)
endif() endif()
# On most UNIX like platforms g++ and clang++ define _GNU_SOURCE as a
# predefined macro, which turns on all of the wonderful libc extensions.
# However g++ doesn't do this in Cygwin so we have to define it ourselfs
# since we depend on GNU/POSIX/BSD extensions.
if (CYGWIN)
add_definitions(-D_GNU_SOURCE=1)
endif()
# Link time optimisation # Link time optimisation
if (BENCHMARK_ENABLE_LTO) if (BENCHMARK_ENABLE_LTO)
add_cxx_compiler_flag(-flto) add_cxx_compiler_flag(-flto)