From f67ee4ad9b565ec6bca595df1278162198962998 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 8 Oct 2016 01:03:23 -0600 Subject: [PATCH] Fix #294. Add -D_GNU_SOURCE when building under Cygwin --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index dfa8a651..8bfd21b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,6 +91,14 @@ else() cxx_feature_check(THREAD_SAFETY_ATTRIBUTES) 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 if (BENCHMARK_ENABLE_LTO) add_cxx_compiler_flag(-flto)