Skip to content

Commit 056b77b

Browse files
authored
Set CMP0157 to OLD only for Windows hosts (#5195)
- **Explanation**: There is no early swift-driver build for the Windows toolchain. As a result, swift-collections fails to build properly when CMP0157 is set to NEW due to object files not being generated. This sets CMP0157 to OLD when targetting Android until the early swift-driver is available on Windows. - **Scope**: The changes are limited to the Android build on Windows. - **Issues**: - swiftlang/swift-foundation#1222 - **Original PRs**: #5180 - **Risk**: Very low. - **Testing**: Fixes the Swift CI 6.1 build. - **Reviewers**: @finagolfin
1 parent 21bb65e commit 056b77b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

CMakeLists.txt

+9-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,15 @@ if(POLICY CMP0156)
2222
endif()
2323

2424
if(POLICY CMP0157)
25-
# New Swift build model: improved incremental build performance and LSP support
26-
cmake_policy(SET CMP0157 NEW)
25+
if(CMAKE_HOST_SYSTEM_NAMESTREQUAL Windows ANDCMAKE_SYSTEM_NAMESTREQUAL Android)
26+
# CMP0157 causes swift-collections to fail to compile when targetting
27+
# Android on Windows due to swift-driver not being present during the
28+
# toolchain build. Disable it for now.
29+
cmake_policy(SET CMP0157 OLD)
30+
else()
31+
# New Swift build model: improved incremental build performance and LSP support
32+
cmake_policy(SET CMP0157 NEW)
33+
endif()
2734
endif()
2835

2936
if (NOTDEFINED CMAKE_C_COMPILER)

0 commit comments

Comments
 (0)
close