Skip to content

Commit 43158de

Browse files
owenvcompnerd
andauthored
CMake fixes to allow use in dependent projects (#196)
* Fix CMake build on macOS/BSDs * Add SwiftSubprocessConfig.cmake for use by dependent CMake projects * Apply suggestions from code review Co-authored-by: Saleem Abdulrasool <[email protected]> --------- Co-authored-by: Saleem Abdulrasool <[email protected]>
1 parent d66519d commit 43158de

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@ add_subdirectory(Sources)
4242
export(EXPORT SwiftSubprocessTargets
4343
FILE "cmake/SwiftSubprocess/SwiftSubprocessTargets.cmake"
4444
NAMESPACE "SwiftSubprocess::")
45+
46+
add_subdirectory(cmake/modules)

Sources/Subprocess/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,14 @@ elseif(APPLE)
4040
Platforms/Subprocess+BSD.swift
4141
Platforms/Subprocess+Darwin.swift
4242
Platforms/Subprocess+Unix.swift)
43+
target_compile_options(Subprocess PRIVATE
44+
"$<$<COMPILE_LANGUAGE:Swift>:-DSUBPROCESS_ASYNCIO_DISPATCH>")
4345
elseif(FREEBSD OR OPENBSD)
4446
target_sources(Subprocess PRIVATE
4547
Platforms/Subprocess+BSD.swift
4648
Platforms/Subprocess+Unix.swift)
49+
target_compile_options(Subprocess PRIVATE
50+
"$<$<COMPILE_LANGUAGE:Swift>:-DSUBPROCESS_ASYNCIO_DISPATCH>")
4751
endif()
4852

4953
target_compile_options(Subprocess PRIVATE

cmake/modules/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
##===----------------------------------------------------------------------===##
2+
##
3+
## This source file is part of the Swift.org open source project
4+
##
5+
## Copyright (c) 2025 Apple Inc. and the Swift project authors
6+
## Licensed under Apache License v2.0 with Runtime Library Exception
7+
##
8+
## See https://swift.org/LICENSE.txt for license information
9+
##
10+
##===----------------------------------------------------------------------===##
11+
12+
configure_file(SwiftSubprocessConfig.cmake.in
13+
${CMAKE_CURRENT_BINARY_DIR}/SwiftSubprocessConfig.cmake)
14+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
##===----------------------------------------------------------------------===##
2+
##
3+
## This source file is part of the Swift.org open source project
4+
##
5+
## Copyright (c) 2025 Apple Inc. and the Swift project authors
6+
## Licensed under Apache License v2.0 with Runtime Library Exception
7+
##
8+
## See https://swift.org/LICENSE.txt for license information
9+
##
10+
##===----------------------------------------------------------------------===##
11+
12+
include(${CMAKE_CURRENT_BINARY_DIR}/../SwiftSubprocess/SwiftSubprocessTargets.cmake)

0 commit comments

Comments
 (0)