|
1 | 1 | include(FetchContent)
|
2 | 2 |
|
3 |
| -set(BUILD_SHARED_LIBS OFF) |
| 3 | +find_package(SwiftSyntax CONFIG) |
| 4 | +if(NOT SwiftSyntax_FOUND) |
| 5 | + if(DEFINED SWIFTPM_PATH_TO_SWIFT_SYNTAX_SOURCE) |
| 6 | + file(TO_CMAKE_PATH "${SWIFTPM_PATH_TO_SWIFT_SYNTAX_SOURCE}" swift_syntax_path) |
| 7 | + FetchContent_Declare(SwiftSyntax |
| 8 | + SOURCE_DIR "${swift_syntax_path}") |
| 9 | + else() |
| 10 | + FetchContent_Declare(SwiftSyntax |
| 11 | + GIT_REPOSITORY https://github.com/apple/swift-syntax |
| 12 | + GIT_TAG main) |
| 13 | + endif() |
| 14 | + FetchContent_MakeAvailable(SwiftSyntax) |
4 | 15 |
|
5 |
| -if(DEFINED SWIFTPM_PATH_TO_SWIFT_SYNTAX_SOURCE) |
6 |
| - file(TO_CMAKE_PATH "${SWIFTPM_PATH_TO_SWIFT_SYNTAX_SOURCE}" swift_syntax_path) |
7 |
| - FetchContent_Declare(SwiftSyntax |
8 |
| - SOURCE_DIR "${swift_syntax_path}") |
9 |
| -else() |
10 |
| - FetchContent_Declare(SwiftSyntax |
11 |
| - GIT_REPOSITORY https://github.com/apple/swift-syntax |
12 |
| - GIT_TAG main) |
| 16 | + # TODO: We should define these in swift-syntax itself and then use the |
| 17 | + # namespaced in all dependents (right now we go the other way around). |
| 18 | + add_library(SwiftSyntax::SwiftBasicFormat ALIAS SwiftBasicFormat) |
| 19 | + add_library(SwiftSyntax::SwiftDiagnostics ALIAS SwiftDiagnostics) |
| 20 | + add_library(SwiftSyntax::SwiftIDEUtils ALIAS SwiftIDEUTils) |
| 21 | + add_library(SwiftSyntax::SwiftParser ALIAS SwiftParser) |
| 22 | + add_library(SwiftSyntax::SwiftSyntax ALIAS SwiftSyntax) |
| 23 | + add_library(SwiftSyntax::SwiftSyntaxBuilder ALIAS SwiftSyntaxBuilder) |
13 | 24 | endif()
|
14 |
| -FetchContent_MakeAvailable(SwiftSyntax) |
|
0 commit comments