dotnet3.1/corefx-optflags-support.patch
Petr Šabata 63a0159abe RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/dotnet3.1#11bc30a3d19a0c0adc112cd6c34a288c7dac64a2
2020-10-14 23:49:41 +02:00

41 lines
1.5 KiB
Diff

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