From a563acec95f721223859b2e704843f6ca78611e7 Mon Sep 17 00:00:00 2001 From: Fabrice de Gans Date: Thu, 27 Feb 2025 11:07:37 -0800 Subject: [PATCH 1/2] Set CMP0157 to OLD for Android 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. --- CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 265c9d3de7..762430295c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,8 +22,15 @@ if(POLICY CMP0156) endif() if(POLICY CMP0157) - # New Swift build model: improved incremental build performance and LSP support - cmake_policy(SET CMP0157 NEW) + if(CMAKE_SYSTEM_NAME STREQUAL Android) + # CMP0157 causes swift-collections to fail to compile when targetting + # Android on Windows due to swift-driver not being present during the + # toolchain build. Disable it for now. + cmake_policy(SET CMP0157 OLD) + else() + # New Swift build model: improved incremental build performance and LSP support + cmake_policy(SET CMP0157 NEW) + endif() endif() if (NOT DEFINED CMAKE_C_COMPILER) From 01576d74016e2d611bca898cd678be1bc44a8525 Mon Sep 17 00:00:00 2001 From: Fabrice de Gans Date: Mon, 3 Mar 2025 09:28:06 -0800 Subject: [PATCH 2/2] Set CMP0157 to OLD only for Windows hosts --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 762430295c..c0d46e43cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ if(POLICY CMP0156) endif() if(POLICY CMP0157) - if(CMAKE_SYSTEM_NAME STREQUAL Android) + if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND CMAKE_SYSTEM_NAME STREQUAL Android) # CMP0157 causes swift-collections to fail to compile when targetting # Android on Windows due to swift-driver not being present during the # toolchain build. Disable it for now.