Blame SOURCES/corefx-optflags-support.patch

105ad9
diff --git a/src/Native/Unix/CMakeLists.txt b/src/Native/Unix/CMakeLists.txt
105ad9
index 7d804a1e54..717c2718d7 100644
105ad9
--- a/src/Native/Unix/CMakeLists.txt
105ad9
+++ b/src/Native/Unix/CMakeLists.txt
105ad9
@@ -25,7 +25,6 @@ add_compile_options(-fPIC)
105ad9
 add_compile_options(-I${CMAKE_CURRENT_SOURCE_DIR}/Common)
105ad9
 add_compile_options(-I${CMAKE_CURRENT_BINARY_DIR}/Common)
105ad9
 add_compile_options(-g)
105ad9
-add_compile_options(-Werror)
105ad9
 if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
105ad9
     add_compile_options(-Wno-unreachable-code)
105ad9
 endif ()
105ad9
diff --git a/src/Native/Unix/configure.cmake b/src/Native/Unix/configure.cmake
105ad9
index f4a30ad6cb..f2db68402a 100644
105ad9
--- a/src/Native/Unix/configure.cmake
105ad9
+++ b/src/Native/Unix/configure.cmake
105ad9
@@ -27,6 +27,12 @@ else ()
105ad9
     message(FATAL_ERROR "Unknown platform.  Cannot define PAL_UNIX_NAME, used by RuntimeInformation.")
105ad9
 endif ()
105ad9
 
105ad9
+
105ad9
+set (PREVIOUS_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
13540a
+set (CMAKE_CXX_FLAGS "-D_GNU_SOURCE")
105ad9
+set (PREVIOUS_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
13540a
+set (CMAKE_C_FLAGS "-D_GNU_SOURCE")
105ad9
+
105ad9
 # We compile with -Werror, so we need to make sure these code fragments compile without warnings.
105ad9
 # Older CMake versions (3.8) do not assign the result of their tests, causing unused-value errors
105ad9
 # which are not distinguished from the test failing. So no error for that one.
105ad9
@@ -698,6 +704,9 @@ endif()
105ad9
 
105ad9
 set (CMAKE_REQUIRED_LIBRARIES)
105ad9
 
105ad9
+set (CMAKE_CXX_FLAGS "${PREVIOUS_CMAKE_CXX_FLAGS}")
105ad9
+set (CMAKE_C_FLAGS "${PREVIOUS_CMAKE_C_FLAGS}")
105ad9
+
105ad9
 check_c_source_compiles(
105ad9
     "
105ad9
     #include <sys/inotify.h>