@@ -116,27 +116,7 @@ filter_prefixed("${CMAKE_ASM_IMPLICIT_INCLUDE_DIRECTORIES}" ${LLVM_BINARY_DIR} C
116116# brittle. We should ideally move this to runtimes/CMakeLists.txt.
117117llvm_check_compiler_linker_flag(C "--unwindlib=none" CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG)
118118if (CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG)
119- set (ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} " )
120- set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --unwindlib=none" )
121- # TODO: When we can require CMake 3.14, we should use
122- # CMAKE_REQUIRED_LINK_OPTIONS here. Until then, we need a workaround:
123- # When using CMAKE_REQUIRED_FLAGS, this option gets added both to
124- # compilation and linking commands. That causes warnings in the
125- # compilation commands during cmake tests. This is normally benign, but
126- # when testing whether -Werror works, that test fails (due to the
127- # preexisting warning).
128- #
129- # Therefore, before we can use CMAKE_REQUIRED_LINK_OPTIONS, check if we
130- # can use --start-no-unused-arguments to silence the warnings about
131- # --unwindlib=none during compilation.
132- #
133- # We must first add --unwindlib=none to CMAKE_REQUIRED_FLAGS above, to
134- # allow this subsequent test to succeed, then rewrite CMAKE_REQUIRED_FLAGS
135- # below.
136- check_c_compiler_flag("--start-no-unused-arguments" C_SUPPORTS_START_NO_UNUSED_ARGUMENTS)
137- if (C_SUPPORTS_START_NO_UNUSED_ARGUMENTS)
138- set (CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS} --start-no-unused-arguments --unwindlib=none --end-no-unused-arguments" )
139- endif ()
119+ set (CMAKE_REQUIRED_LINK_OPTIONS "${CMAKE_REQUIRED_LINK_OPTIONS} --unwindlib=none" )
140120endif ()
141121
142122# Disable use of the installed C++ standard library when building runtimes.
0 commit comments