Skip to content

Commit 13d250b

Browse files
committed
build: simplify the handling for CMP0157
We can use the `CMAKE_Swift_USE_OLD_DRIVER` option to control the behaviour as the issue is related to the old Swift driver.
1 parent 2f1ea48 commit 13d250b

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

CMakeLists.txt

+4-12
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
cmake_minimum_required(VERSION 3.26...3.29)
22

3-
if(POLICY CMP0157)
4-
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND CMAKE_SYSTEM_NAME STREQUAL Android)
5-
# CMP0157 causes libdispatch to fail to compile when targetting
6-
# Android on Windows due to swift-driver not being present during the
7-
# toolchain build. Disable it for now.
8-
cmake_policy(SET CMP0157 OLD)
9-
else()
10-
# New Swift build model: improved incremental build performance and LSP support
11-
cmake_policy(SET CMP0157 NEW)
12-
endif()
13-
endif()
14-
153
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
164

5+
if(POLICY CMP0157 AND CMAKE_Swift_COMPILER_USE_OLD_DRIVER)
6+
cmake_policy(SET CMP0157 OLD)
7+
endif()
8+
179
project(dispatch
1810
VERSION 1.3
1911
LANGUAGES C CXX)

0 commit comments

Comments
 (0)