Blame SOURCES/corefx-optflags-support.patch

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