Skip to content

Commit 2428f6d

Browse files
committed
[CMake] Disable the new Swift Swift parser if we can't find its targets file
This allows us to more gracefully degrade when a host Swift toolchain can't be found, and the early SwiftSyntax build is skipped as a result.
1 parent 27b83b0 commit 2428f6d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,8 +872,14 @@ endif()
872872

873873
# When we have the early SwiftSyntax build, we can include its parser.
874874
if(SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR)
875-
set(SWIFT_SWIFT_PARSER TRUE)
876-
include(${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR}/cmake/SwiftSyntaxTargets.cmake)
875+
set(SWIFT_PATH_TO_EARLYSWIFTSYNTAX_TARGETS
876+
${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR}/cmake/SwiftSyntaxTargets.cmake)
877+
if(NOT EXISTS "${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_TARGETS}")
878+
message(STATUS "Skipping Swift Swift parser integration due to missing early SwiftSyntax")
879+
else()
880+
set(SWIFT_SWIFT_PARSER TRUE)
881+
include(${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_TARGETS})
882+
endif()
877883
endif()
878884

879885

0 commit comments

Comments
 (0)