Skip to content

Commit fe82b3e

Browse files
committed
[cmake] Recover original CMAKE_C/CXX_COMPILER after changing them.
Seems that the change in the two variables was spilling into the other target of the file, but returning it back to the original values seems to avoid that issue. This should unbreak the Android CI build. In it, the Linux static library was changing to the host compiler, and that compiler was being used for the Android runtime library, which would have never compile that way (since the host compiler in CI is an old-ish Clang without the necessary argument).
1 parent 647a29b commit fe82b3e

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

stdlib/public/Reflection/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ if(SWIFT_INCLUDE_TOOLS)
3434
endif()
3535

3636
if(NOT SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER)
37+
set(CURRENT_CMAKE_C_COMPILER ${CMAKE_C_COMPILER})
38+
set(CURRENT_CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER})
3739
set(CMAKE_C_COMPILER ${HOST_CMAKE_C_COMPILER})
3840
set(CMAKE_CXX_COMPILER ${HOST_CMAKE_CXX_COMPILER})
3941
endif()
@@ -44,5 +46,9 @@ if(SWIFT_INCLUDE_TOOLS)
4446
${SWIFT_RUNTIME_CXX_FLAGS})
4547
set_property(TARGET swiftReflection
4648
APPEND_STRING PROPERTY LINK_FLAGS ${SWIFT_RUNTIME_LINK_FLAGS})
47-
endif()
4849

50+
if(NOT SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER)
51+
set(CMAKE_C_COMPILER ${CURRENT_CMAKE_C_COMPILER})
52+
set(CMAKE_CXX_COMPILER ${CURRENT_CMAKE_CXX_COMPILER})
53+
endif()
54+
endif()

stdlib/public/SwiftRemoteMirror/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ if(SWIFT_INCLUDE_TOOLS)
2222
endif()
2323

2424
if(NOT SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER)
25+
set(CURRENT_CMAKE_C_COMPILER ${CMAKE_C_COMPILER})
26+
set(CURRENT_CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER})
2527
set(CMAKE_C_COMPILER ${HOST_CMAKE_C_COMPILER})
2628
set(CMAKE_CXX_COMPILER ${HOST_CMAKE_CXX_COMPILER})
2729
endif()
@@ -32,5 +34,9 @@ if(SWIFT_INCLUDE_TOOLS)
3234
${SWIFT_RUNTIME_CXX_FLAGS})
3335
set_property(TARGET swiftRemoteMirror APPEND_STRING PROPERTY LINK_FLAGS
3436
${SWIFT_RUNTIME_LINK_FLAGS})
35-
endif()
3637

38+
if(NOT SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER)
39+
set(CMAKE_C_COMPILER ${CURRENT_CMAKE_C_COMPILER})
40+
set(CMAKE_CXX_COMPILER ${CURRENT_CMAKE_CXX_COMPILER})
41+
endif()
42+
endif()

0 commit comments

Comments
 (0)