Skip to content

Commit 71d8118

Browse files
committed
Fix the clang dependency of sourcekit libraries.
Because swift_swap_compiler_if_needed updates the compiler ID to Clang, we need to account for it when deciding to add a dependency on clang. Otherwise, the sourcekit build could fail due to the clang executable not having been built there yet.
1 parent fa3ba92 commit 71d8118

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

cmake/modules/SwiftWindowsSupport.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ macro(swift_swap_compiler_if_needed target)
104104
endif()
105105
set(CMAKE_C_COMPILER_ID Clang)
106106
set(CMAKE_CXX_COMPILER_ID Clang)
107+
set(SOURCEKIT_SWIFT_SWAP_COMPILER TRUE)
107108
message(STATUS "C/C++ compiler for ${target} is set to: ${CMAKE_C_COMPILER}")
108109
else()
109110
message(SEND_ERROR "${target} requires a clang based compiler. Please set SWIFT_CLANG_LOCATION.")

tools/SourceKit/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
88
message(SEND_ERROR "SourceKit cannot be built standalone")
99
endif()
1010

11+
set(SOURCEKIT_SWIFT_SWAP_COMPILER FALSE)
1112
include(SwiftWindowsSupport)
1213
swift_swap_compiler_if_needed("SourceKit")
1314

tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ macro(add_sourcekit_library name)
235235
set(libkind)
236236
endif()
237237
add_library(${name} ${libkind} ${srcs})
238-
if(NOT SWIFT_BUILT_STANDALONE AND NOT CMAKE_C_COMPILER_ID MATCHES Clang)
238+
if(NOT SWIFT_BUILT_STANDALONE AND SOURCEKIT_SWIFT_SWAP_COMPILER)
239239
add_dependencies(${name} clang)
240240
endif()
241241
llvm_update_compile_flags(${name})
@@ -325,7 +325,7 @@ macro(add_sourcekit_executable name)
325325
"${SOURCEKIT_EXECUTABLE_multiple_parameter_options}" ${ARGN})
326326

327327
add_executable(${name} ${SOURCEKITEXE_UNPARSED_ARGUMENTS})
328-
if(NOT SWIFT_BUILT_STANDALONE AND NOT CMAKE_C_COMPILER_ID MATCHES Clang)
328+
if(NOT SWIFT_BUILT_STANDALONE AND SOURCEKIT_SWIFT_SWAP_COMPILER)
329329
add_dependencies(${name} clang)
330330
endif()
331331
llvm_update_compile_flags(${name})

0 commit comments

Comments
 (0)