Skip to content

Commit 7172447

Browse files
committed
Include SwiftSupport when needed
Support for Swift is only needed when we have Swift enabled. We don't need to include the module when it isn't available. With the change to query the Swift compiler for the module triple, we need the Swift language to be enabled to set the swift module triple. Since the include was pulled from the main CMakeLists file, it's prudent to set the include guard to prevent accidentally loading the module multiple times.
1 parent 98bcd9b commit 7172447

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ include(DispatchAppleOptions)
117117
include(DispatchSanitization)
118118
include(DispatchCompilerWarnings)
119119
include(DTrace)
120-
include(SwiftSupport)
121120

122121
# NOTE(abdulras) this is the CMake supported way to control whether we generate
123122
# shared or static libraries. This impacts the behaviour of `add_library` in

cmake/modules/SwiftSupport.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
include_guard()
2+
13
if(NOT dispatch_MODULE_TRIPLE)
24
set(module_triple_command "${CMAKE_Swift_COMPILER}" -print-target-info)
35
if(CMAKE_Swift_COMPILER_TARGET)

src/swift/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
include(SwiftSupport)
2+
13
if(HAVE_OBJC)
24
add_library(DispatchStubs STATIC
35
DispatchStubs.m)

0 commit comments

Comments
 (0)