Blame SOURCES/corefx-optflags-support.patch

bb9e87
diff --git a/src/Native/Unix/CMakeLists.txt b/src/Native/Unix/CMakeLists.txt
bb9e87
index 7d804a1e54..717c2718d7 100644
bb9e87
--- a/src/Native/Unix/CMakeLists.txt
bb9e87
+++ b/src/Native/Unix/CMakeLists.txt
bb9e87
@@ -25,7 +25,6 @@ add_compile_options(-fPIC)
bb9e87
 add_compile_options(-I${CMAKE_CURRENT_SOURCE_DIR}/Common)
bb9e87
 add_compile_options(-I${CMAKE_CURRENT_BINARY_DIR}/Common)
bb9e87
 add_compile_options(-g)
bb9e87
-add_compile_options(-Werror)
bb9e87
 if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
bb9e87
     add_compile_options(-Wno-unreachable-code)
bb9e87
 endif ()
bb9e87
diff --git a/src/Native/Unix/System.Security.Cryptography.Native/configure.cmake b/src/Native/Unix/System.Security.Cryptography.Native/configure.cmake
bb9e87
index 809ffe318e..de55150e36 100644
bb9e87
--- a/src/Native/Unix/System.Security.Cryptography.Native/configure.cmake
bb9e87
+++ b/src/Native/Unix/System.Security.Cryptography.Native/configure.cmake
bb9e87
@@ -3,6 +3,11 @@ include(CheckFunctionExists)
bb9e87
 include(CheckLibraryExists)
bb9e87
 include(CheckFunctionExists)
bb9e87
 
bb9e87
+set (PREVIOUS_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
bb9e87
+set (CMAKE_CXX_FLAGS "-D_GNU_SOURCE")
bb9e87
+set (PREVIOUS_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
bb9e87
+set (CMAKE_C_FLAGS "-D_GNU_SOURCE")
bb9e87
+
bb9e87
 set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
bb9e87
 set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY})
bb9e87
 
bb9e87
@@ -17,6 +22,9 @@ check_function_exists(
bb9e87
 	SSL_get0_alpn_selected
bb9e87
 	HAVE_OPENSSL_ALPN)
bb9e87
 
bb9e87
+set (CMAKE_CXX_FLAGS "${PREVIOUS_CMAKE_CXX_FLAGS}")
bb9e87
+set (CMAKE_C_FLAGS "${PREVIOUS_CMAKE_C_FLAGS}")
bb9e87
+
bb9e87
 configure_file(
bb9e87
     ${CMAKE_CURRENT_SOURCE_DIR}/pal_crypto_config.h.in
bb9e87
     ${CMAKE_CURRENT_BINARY_DIR}/pal_crypto_config.h)
bb9e87
diff --git a/src/Native/Unix/configure.cmake b/src/Native/Unix/configure.cmake
bb9e87
index f4a30ad6cb..cf8eaa73d3 100644
bb9e87
--- a/src/Native/Unix/configure.cmake
bb9e87
+++ b/src/Native/Unix/configure.cmake
bb9e87
@@ -27,6 +27,11 @@ else ()
bb9e87
     message(FATAL_ERROR "Unknown platform.  Cannot define PAL_UNIX_NAME, used by RuntimeInformation.")
bb9e87
 endif ()
bb9e87
 
bb9e87
+set (PREVIOUS_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
bb9e87
+set (CMAKE_CXX_FLAGS "-D_GNU_SOURCE")
bb9e87
+set (PREVIOUS_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
bb9e87
+set (CMAKE_C_FLAGS "-D_GNU_SOURCE")
bb9e87
+
bb9e87
 # We compile with -Werror, so we need to make sure these code fragments compile without warnings.
bb9e87
 # Older CMake versions (3.8) do not assign the result of their tests, causing unused-value errors
bb9e87
 # which are not distinguished from the test failing. So no error for that one.
bb9e87
@@ -709,6 +714,9 @@ check_c_source_compiles(
bb9e87
     "
bb9e87
     HAVE_IN_EXCL_UNLINK)
bb9e87
 
bb9e87
+set (CMAKE_CXX_FLAGS "${PREVIOUS_CMAKE_CXX_FLAGS}")
bb9e87
+set (CMAKE_C_FLAGS "${PREVIOUS_CMAKE_C_FLAGS}")
bb9e87
+
bb9e87
 configure_file(
bb9e87
     ${CMAKE_CURRENT_SOURCE_DIR}/Common/pal_config.h.in
bb9e87
     ${CMAKE_CURRENT_BINARY_DIR}/Common/pal_config.h)