Files
Alex Hoppen ee53f858c5 Globally ignore SIGPIPE on Linux
We receive a `SIGPIPE` if we write to a pipe that points to a crashed process. This in particular happens if the target of a `JSONRPCConnection` has crashed and we try to send it a message.
On Darwin, `DispatchIO` ignores `SIGPIPE` for the pipes handled by it, but that features is not available on Linux.
Instead, globally ignore `SIGPIPE` on Linux to prevent us from crashing if the `JSONRPCConnection`'s target crashes.

Fixes rdar://75580936
2021-03-22 22:40:47 +01:00

23 lines
1.1 KiB
CMake

add_library(LanguageServerProtocolJSONRPC
DisableSigpipe.swift
JSONRPCConnection.swift
MessageCoding.swift
MessageSplitting.swift)
set_target_properties(LanguageServerProtocolJSONRPC PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
target_link_libraries(LanguageServerProtocolJSONRPC PRIVATE
LanguageServerProtocol
LSPLogging)
if(BUILD_SHARED_LIBS)
get_swift_host_arch(swift_arch)
install(TARGETS LanguageServerProtocolJSONRPC
ARCHIVE DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>
LIBRARY DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>
RUNTIME DESTINATION bin)
install(FILES
$<TARGET_PROPERTY:LanguageServerProtocolJSONRPC,Swift_MODULE_DIRECTORY>/LanguageServerProtocolJSONRPC.swiftdoc
$<TARGET_PROPERTY:LanguageServerProtocolJSONRPC,Swift_MODULE_DIRECTORY>/LanguageServerProtocolJSONRPC.swiftmodule
DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>/${swift_arch})
endif()