mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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.
This commit is contained in:
@@ -104,6 +104,7 @@ macro(swift_swap_compiler_if_needed target)
|
||||
endif()
|
||||
set(CMAKE_C_COMPILER_ID Clang)
|
||||
set(CMAKE_CXX_COMPILER_ID Clang)
|
||||
set(SOURCEKIT_SWIFT_SWAP_COMPILER TRUE)
|
||||
message(STATUS "C/C++ compiler for ${target} is set to: ${CMAKE_C_COMPILER}")
|
||||
else()
|
||||
message(SEND_ERROR "${target} requires a clang based compiler. Please set SWIFT_CLANG_LOCATION.")
|
||||
|
||||
@@ -8,6 +8,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
message(SEND_ERROR "SourceKit cannot be built standalone")
|
||||
endif()
|
||||
|
||||
set(SOURCEKIT_SWIFT_SWAP_COMPILER FALSE)
|
||||
include(SwiftWindowsSupport)
|
||||
swift_swap_compiler_if_needed("SourceKit")
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ macro(add_sourcekit_library name)
|
||||
set(libkind)
|
||||
endif()
|
||||
add_library(${name} ${libkind} ${srcs})
|
||||
if(NOT SWIFT_BUILT_STANDALONE AND NOT CMAKE_C_COMPILER_ID MATCHES Clang)
|
||||
if(NOT SWIFT_BUILT_STANDALONE AND SOURCEKIT_SWIFT_SWAP_COMPILER)
|
||||
add_dependencies(${name} clang)
|
||||
endif()
|
||||
llvm_update_compile_flags(${name})
|
||||
@@ -325,7 +325,7 @@ macro(add_sourcekit_executable name)
|
||||
"${SOURCEKIT_EXECUTABLE_multiple_parameter_options}" ${ARGN})
|
||||
|
||||
add_executable(${name} ${SOURCEKITEXE_UNPARSED_ARGUMENTS})
|
||||
if(NOT SWIFT_BUILT_STANDALONE AND NOT CMAKE_C_COMPILER_ID MATCHES Clang)
|
||||
if(NOT SWIFT_BUILT_STANDALONE AND SOURCEKIT_SWIFT_SWAP_COMPILER)
|
||||
add_dependencies(${name} clang)
|
||||
endif()
|
||||
llvm_update_compile_flags(${name})
|
||||
|
||||
Reference in New Issue
Block a user