diff --git a/CMakeLists.txt b/CMakeLists.txt index f07181f..9ffc2b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,3 +42,5 @@ add_subdirectory(Sources) export(EXPORT SwiftSubprocessTargets FILE "cmake/SwiftSubprocess/SwiftSubprocessTargets.cmake" NAMESPACE "SwiftSubprocess::") + +add_subdirectory(cmake/modules) diff --git a/Sources/Subprocess/CMakeLists.txt b/Sources/Subprocess/CMakeLists.txt index 5c1cfd3..cb77d23 100644 --- a/Sources/Subprocess/CMakeLists.txt +++ b/Sources/Subprocess/CMakeLists.txt @@ -40,10 +40,14 @@ elseif(APPLE) Platforms/Subprocess+BSD.swift Platforms/Subprocess+Darwin.swift Platforms/Subprocess+Unix.swift) + target_compile_options(Subprocess PRIVATE + "$<$:-DSUBPROCESS_ASYNCIO_DISPATCH>") elseif(FREEBSD OR OPENBSD) target_sources(Subprocess PRIVATE Platforms/Subprocess+BSD.swift Platforms/Subprocess+Unix.swift) + target_compile_options(Subprocess PRIVATE + "$<$:-DSUBPROCESS_ASYNCIO_DISPATCH>") endif() target_compile_options(Subprocess PRIVATE diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt new file mode 100644 index 0000000..a482a5e --- /dev/null +++ b/cmake/modules/CMakeLists.txt @@ -0,0 +1,14 @@ +##===----------------------------------------------------------------------===## +## +## This source file is part of the Swift.org open source project +## +## Copyright (c) 2025 Apple Inc. and the Swift project authors +## Licensed under Apache License v2.0 with Runtime Library Exception +## +## See https://swift.org/LICENSE.txt for license information +## +##===----------------------------------------------------------------------===## + +configure_file(SwiftSubprocessConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/SwiftSubprocessConfig.cmake) + diff --git a/cmake/modules/SwiftSubprocessConfig.cmake.in b/cmake/modules/SwiftSubprocessConfig.cmake.in new file mode 100644 index 0000000..db0053f --- /dev/null +++ b/cmake/modules/SwiftSubprocessConfig.cmake.in @@ -0,0 +1,12 @@ +##===----------------------------------------------------------------------===## +## +## This source file is part of the Swift.org open source project +## +## Copyright (c) 2025 Apple Inc. and the Swift project authors +## Licensed under Apache License v2.0 with Runtime Library Exception +## +## See https://swift.org/LICENSE.txt for license information +## +##===----------------------------------------------------------------------===## + +include(${CMAKE_CURRENT_BINARY_DIR}/../SwiftSubprocess/SwiftSubprocessTargets.cmake)