Blame SOURCES/corefx-optflags-support.patch

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