Blame SOURCES/corefx-optflags-support.patch

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