if(SWIFT_HOST_VARIANT MATCHES "^iphoneos")
  set(SWIFT_LANG_TARGET_SDK "IOS")
elseif(SWIFT_HOST_VARIANT MATCHES "^iphonesimulator")
  set(SWIFT_LANG_TARGET_SDK "IOS_SIMULATOR")
elseif(SWIFT_HOST_VARIANT MATCHES "^macosx")
  set(SWIFT_LANG_TARGET_SDK "OSX")
else()
  message(SEND_ERROR "Unknown SDK for SwiftLang")
endif()

add_swift_target_library(swiftSwiftLang SHARED
  SwiftLang.swift
  SourceKitdClient.swift
  SourceKitdRequest.swift
  SourceKitdResponse.swift
  SourceKitdUID.swift

  GYB_SOURCES
    UIDs.swift.gyb

  DEPENDS sourcekitd
  SWIFT_MODULE_DEPENDS_OSX Darwin Foundation
  PRIVATE_LINK_LIBRARIES sourcekitd
  SWIFT_COMPILE_FLAGS -F${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib
  INSTALL_IN_COMPONENT sourcekit-xpc-service
  DARWIN_INSTALL_NAME_DIR "@rpath"
  TARGET_SDKS ${SWIFT_LANG_TARGET_SDK}
  IS_STDLIB)

if(SWIFT_HOST_VARIANT MATCHES "^iphoneos")
  set(SWIFT_LANG_TARGET_SDK "IOS")
elseif(SWIFT_HOST_VARIANT MATCHES "^iphonesimulator")
  set(SWIFT_LANG_TARGET_SDK "IOS_SIMULATOR")
elseif(SWIFT_HOST_VARIANT MATCHES "^macosx")
  set(SWIFT_LANG_TARGET_SDK "OSX")
else()
  message(SEND_ERROR "Unknown SDK for SwiftLang")
endif()

add_swift_target_library(swiftSwiftLang SHARED
  SwiftLang.swift
  SourceKitdClient.swift
  SourceKitdRequest.swift
  SourceKitdResponse.swift
  SourceKitdUID.swift

  GYB_SOURCES
    UIDs.swift.gyb

  SWIFT_MODULE_DEPENDS_OSX Darwin Foundation
  PRIVATE_LINK_LIBRARIES sourcekitd
  SWIFT_COMPILE_FLAGS -F${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib
  INSTALL_IN_COMPONENT sourcekit-xpc-service
  DARWIN_INSTALL_NAME_DIR "@rpath"
  TARGET_SDKS ${SWIFT_LANG_TARGET_SDK}
  IS_STDLIB)

Revert "[swift-lang] Fix dependency on sourcekitd module"
Revert "[swift-lang] Fix dependency on sourcekitd module"

This reverts commit 0ab98fc0e41a300dbd5ca3c76635dd21292124d9.
