1
1
##===----------------------------------------------------------------------===##
2
2
##
3
- ## This source file is part of the SwiftFoundation open source project
3
+ ## This source file is part of the Swift open source project
4
4
##
5
- ## Copyright (c) 2024 Apple Inc. and the SwiftFoundation project authors
5
+ ## Copyright (c) 2024 Apple Inc. and the Swift project authors
6
6
## Licensed under Apache License v2.0
7
7
##
8
8
## 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
10
10
##
11
11
## SPDX-License-Identifier: Apache-2.0
12
12
##
13
13
##===----------------------------------------------------------------------===##
14
14
15
15
cmake_minimum_required (VERSION 3.22 )
16
16
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
+
17
27
project (SwiftFoundation
18
28
LANGUAGES C Swift )
19
29
@@ -25,11 +35,28 @@ set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
25
35
set (BUILD_TESTING NO )
26
36
27
37
# 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 )
31
58
32
- # Availability Macros
59
+ # Availability Macros (only applies to FoundationEssentials and FoundationInternationalization)
33
60
set (_SwiftFoundation_availability_macros )
34
61
list (APPEND _SwiftFoundation_availability_macros
35
62
"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