File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,17 @@ if (NOT LIBCXXABI_USE_COMPILER_RT)
14
14
endif ()
15
15
endif ()
16
16
17
+ # Disable linker for CMake flag compatibility checks
18
+ #
19
+ # Due to https://gitlab.kitware.com/cmake/cmake/-/issues/23454, we need to
20
+ # disable CMAKE_REQUIRED_LINK_OPTIONS (c.f. CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG),
21
+ # for static targets; cache the target type here, and reset it after the various
22
+ # checks have been performed.
23
+ set (_previous_CMAKE_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE} )
24
+ set (_previous_CMAKE_REQUIRED_LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS} )
25
+ set (CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY )
26
+ set (CMAKE_REQUIRED_LINK_OPTIONS )
27
+
17
28
# libc++abi is using -nostdlib++ at the link step when available,
18
29
# otherwise -nodefaultlibs is used. We want all our checks to also
19
30
# use one of these options, otherwise we may end up with an inconsistency between
@@ -94,6 +105,10 @@ endif()
94
105
# Check compiler flags
95
106
check_cxx_compiler_flag (-nostdinc++ CXX_SUPPORTS_NOSTDINCXX_FLAG )
96
107
108
+ # reset CMAKE_TRY_COMPILE_TARGET_TYPE & CMAKE_REQUIRED_LINK_OPTIONS after flag checks
109
+ set (CMAKE_TRY_COMPILE_TARGET_TYPE ${_previous_CMAKE_TRY_COMPILE_TARGET_TYPE} )
110
+ set (CMAKE_REQUIRED_LINK_OPTIONS ${_previous_CMAKE_REQUIRED_LINK_OPTIONS} )
111
+
97
112
# Check libraries
98
113
if (FUCHSIA )
99
114
set (LIBCXXABI_HAS_DL_LIB NO )
You can’t perform that action at this time.
0 commit comments