File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -234,6 +234,10 @@ endif()
234
234
add_cxx_compile_flags_if_supported (-fno-exceptions )
235
235
add_cxx_compile_flags_if_supported (-fno-rtti )
236
236
237
+ # reset CMAKE_TRY_COMPILE_TARGET_TYPE & CMAKE_REQUIRED_LINK_OPTIONS after flag checks
238
+ set (CMAKE_TRY_COMPILE_TARGET_TYPE ${_previous_CMAKE_TRY_COMPILE_TARGET_TYPE} )
239
+ set (CMAKE_REQUIRED_LINK_OPTIONS ${_previous_CMAKE_REQUIRED_LINK_OPTIONS} )
240
+
237
241
# Ensure that we don't depend on C++ standard library.
238
242
if (CXX_SUPPORTS_NOSTDINCXX_FLAG )
239
243
list (APPEND LIBUNWIND_COMPILE_FLAGS -nostdinc++ )
@@ -287,10 +291,6 @@ if (LIBUNWIND_ENABLE_ARM_WMMX)
287
291
add_compile_flags (-D__ARM_WMMX )
288
292
endif ()
289
293
290
- # reset CMAKE_TRY_COMPILE_TARGET_TYPE & CMAKE_REQUIRED_LINK_OPTIONS after flag checks
291
- set (CMAKE_TRY_COMPILE_TARGET_TYPE ${_previous_CMAKE_TRY_COMPILE_TARGET_TYPE} )
292
- set (CMAKE_REQUIRED_LINK_OPTIONS ${_previous_CMAKE_REQUIRED_LINK_OPTIONS} )
293
-
294
294
if (LIBUNWIND_IS_BAREMETAL )
295
295
add_compile_definitions (_LIBUNWIND_IS_BAREMETAL )
296
296
endif ()
Original file line number Diff line number Diff line change @@ -3,6 +3,18 @@ include(HandleFlags)
3
3
# Warning flags ===============================================================
4
4
function (cxx_add_warning_flags target enable_werror enable_pedantic )
5
5
target_compile_definitions (${target} PUBLIC -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER )
6
+
7
+ # Disable linker for CMake flag compatibility checks
8
+ #
9
+ # Due to https://gitlab.kitware.com/cmake/cmake/-/issues/23454, we need to
10
+ # disable CMAKE_REQUIRED_LINK_OPTIONS (c.f. CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG),
11
+ # for static targets; cache the target type here, and reset it after the various
12
+ # checks have been performed.
13
+ set (_previous_CMAKE_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE} )
14
+ set (_previous_CMAKE_REQUIRED_LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS} )
15
+ set (CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY )
16
+ set (CMAKE_REQUIRED_LINK_OPTIONS )
17
+
6
18
if (MSVC )
7
19
# -W4 is the cl.exe/clang-cl equivalent of -Wall. (In cl.exe and clang-cl,
8
20
# -Wall is equivalent to -Weverything in GCC style compiler drivers.)
@@ -74,4 +86,8 @@ function(cxx_add_warning_flags target enable_werror enable_pedantic)
74
86
if (${enable_pedantic} )
75
87
target_add_compile_flags_if_supported (${target} PRIVATE -pedantic )
76
88
endif ()
89
+
90
+ # reset CMAKE_TRY_COMPILE_TARGET_TYPE & CMAKE_REQUIRED_LINK_OPTIONS after flag checks
91
+ set (CMAKE_TRY_COMPILE_TARGET_TYPE ${_previous_CMAKE_TRY_COMPILE_TARGET_TYPE} )
92
+ set (CMAKE_REQUIRED_LINK_OPTIONS ${_previous_CMAKE_REQUIRED_LINK_OPTIONS} )
77
93
endfunction ()
You can’t perform that action at this time.
0 commit comments