11##===----------------------------------------------------------------------===##
22##
3- ## This source file is part of the SwiftFoundation open source project
3+ ## This source file is part of the Swift open source project
44##
5- ## Copyright (c) 2024 Apple Inc. and the SwiftFoundation project authors
5+ ## Copyright (c) 2024 Apple Inc. and the Swift project authors
66## Licensed under Apache License v2.0
77##
88## See LICENSE.txt for license information
9- ## See CONTRIBUTORS.md for the list of SwiftFoundation project authors
9+ ## See CONTRIBUTORS.md for the list of Swift project authors
1010##
1111## SPDX-License-Identifier: Apache-2.0
1212##
1313##===----------------------------------------------------------------------===##
1414
1515cmake_minimum_required (VERSION 3.22)
1616
17+ if (POLICY CMP0156)
18+ # Deduplicate linked libraries where appropriate
19+ cmake_policy (SET CMP0156 NEW)
20+ endif ()
21+
22+ if (POLICY CMP0157)
23+ # New Swift build model: improved incremental build performance and LSP support
24+ cmake_policy (SET CMP0157 NEW)
25+ endif ()
26+
1727project (SwiftFoundation
1828 LANGUAGES C Swift)
1929
@@ -25,11 +35,28 @@ set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
2535set (BUILD_TESTING NO )
2636
2737# Make sure our dependencies exists
28- find_package (SwiftCollections CONFIG REQUIRED)
29- find_package (SwiftFoundationICU CONFIG REQUIRED)
30- # In the future we will fetch these dependencies if none found
38+ include (FetchContent)
39+ if (_SwiftFoundationICU_SourceDIR)
40+ FetchContent_Declare(SwiftFoundationICU
41+ SOURCE_DIR ${_SwiftFoundationICU_SourceDIR} )
42+ else ()
43+ FetchContent_Declare(SwiftFoundationICU
44+ GIT_REPOSITORY https://github.com/iCharlesHu/swift-foundation-icu.git
45+ GIT_TAG charles/cmake-support)
46+ endif ()
47+ FetchContent_MakeAvailable(SwiftFoundationICU)
48+
49+ if (_SwiftCollections_SourceDIR)
50+ FetchContent_Declare(SwiftCollections
51+ SOURCE_DIR ${_SwiftCollections_SourceDIR} )
52+ else ()
53+ FetchContent_Declare(SwiftCollections
54+ GIT_REPOSITORY https://github.com/apple /swift-collections.git
55+ GIT_TAG release/1.1)
56+ endif ()
57+ FetchContent_MakeAvailable(SwiftCollections)
3158
32- # Availability Macros
59+ # Availability Macros (only applies to FoundationEssentials and FoundationInternationalization)
3360set (_SwiftFoundation_availability_macros)
3461list (APPEND _SwiftFoundation_availability_macros
3562 "SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend \" AvailabilityMacro=FoundationPreview 0.1:macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4\" >"
0 commit comments