From 12b0abc19498e562a8d97eebb67a11e9e6a255dd Mon Sep 17 00:00:00 2001 From: Charles Zablit Date: Thu, 5 Nov 2026 13:44:14 +0000 Subject: [PATCH] [CMake] Enable CMP0157 and keep whole-module builds for optimized configs (#139) Enable CMP0157 so Ninja compiles each Swift module in its own step, separate from the link. Optimized configurations keep `-wmo`, as under the old policy. Tracking: swiftlang/swift#93995 assisted by Claude --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f17718..a2d2056 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,9 +14,17 @@ cmake_minimum_required(VERSION 3.19) +if(POLICY CMP0157) + cmake_policy(SET CMP0157 NEW) +endif() + project(SwiftASN1 LANGUAGES Swift) +if(POLICY CMP0157 AND PROJECT_IS_TOP_LEVEL) + set(CMAKE_Swift_COMPILATION_MODE "$,wholemodule,incremental>") +endif() + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) include(SwiftSupport)