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 @@ -6,6 +6,17 @@ include(CheckCCompilerFlag)
6
6
include (CheckCXXCompilerFlag )
7
7
include (CheckCSourceCompiles )
8
8
9
+ # Disable linker for CMake flag compatibility checks
10
+ #
11
+ # Due to https://gitlab.kitware.com/cmake/cmake/-/issues/23454, we need to
12
+ # disable CMAKE_REQUIRED_LINK_OPTIONS (c.f. CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG),
13
+ # for static targets; cache the target type here, and reset it after the various
14
+ # checks have been performed.
15
+ set (_previous_CMAKE_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE} )
16
+ set (_previous_CMAKE_REQUIRED_LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS} )
17
+ set (CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY )
18
+ set (CMAKE_REQUIRED_LINK_OPTIONS )
19
+
9
20
# The compiler driver may be implicitly trying to link against libunwind.
10
21
# This is normally ok (libcxx relies on an unwinder), but if libunwind is
11
22
# built in the same cmake invocation as libcxx and we've got
@@ -98,6 +109,10 @@ int main(void) { return 0; }
98
109
cmake_pop_check_state ()
99
110
endif ()
100
111
112
+ # reset CMAKE_TRY_COMPILE_TARGET_TYPE & CMAKE_REQUIRED_LINK_OPTIONS after flag checks
113
+ set (CMAKE_TRY_COMPILE_TARGET_TYPE ${_previous_CMAKE_TRY_COMPILE_TARGET_TYPE} )
114
+ set (CMAKE_REQUIRED_LINK_OPTIONS ${_previous_CMAKE_REQUIRED_LINK_OPTIONS} )
115
+
101
116
check_symbol_exists (__PICOLIBC__ "string.h" PICOLIBC )
102
117
103
118
# Check libraries
You can’t perform that action at this time.
0 commit comments