Skip to content

Commit a5dfbc2

Browse files
[CMake] Set CMP0157 to OLD when targeting Android with the Windows toolchain (#1009)
There is no early swift-driver build for the Windows toolchain. As a result, swift-testing fails to build properly when CMP0157 is set to NEW due to object files not being generated. This sets CMP0157 to OLD when targeting Android with the Windows toolchain until the early swift-driver is available on Windows. This is analog to swiftlang/swift-corelibs-foundation#5180 ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent fc6f68c commit a5dfbc2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

CMakeLists.txt

+8-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@
99
cmake_minimum_required(VERSION 3.19.6...3.29)
1010

1111
if(POLICY CMP0157)
12-
cmake_policy(SET CMP0157 NEW)
12+
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND CMAKE_SYSTEM_NAME STREQUAL Android)
13+
# CMP0157 causes builds to fail when targetting Android with the Windows
14+
# toolchain, because the early swift-driver isn't (yet) available. Disable
15+
# it for now.
16+
cmake_policy(SET CMP0157 OLD)
17+
else()
18+
cmake_policy(SET CMP0157 NEW)
19+
endif()
1320
endif()
1421

1522
project(SwiftTesting

0 commit comments

Comments
 (0)