Skip to content

Commit bbfd56e

Browse files
authored
Merge pull request #2363 from drodriguez/cmake-cross-compile-executables
[cmake] Allow cross-compilation of add_swift_executable targets.
2 parents 000c62b + 7a0fcb9 commit bbfd56e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,8 @@ endif()
386386
add_swift_executable(plutil
387387
SOURCES
388388
Tools/plutil/main.swift
389+
TARGET
390+
${CMAKE_C_COMPILER_TARGET}
389391
CFLAGS
390392
-F${CMAKE_CURRENT_BINARY_DIR}
391393
LINK_FLAGS
@@ -409,6 +411,8 @@ add_swift_executable(plutil
409411

410412
if(ENABLE_TESTING)
411413
add_swift_executable(xdgTestHelper
414+
TARGET
415+
${CMAKE_C_COMPILER_TARGET}
412416
CFLAGS
413417
-F${CMAKE_CURRENT_BINARY_DIR}
414418
LINK_FLAGS
@@ -528,6 +532,8 @@ if(ENABLE_TESTING)
528532
TestFoundation/TestUUID.swift
529533
TestFoundation/TestXMLDocument.swift
530534
TestFoundation/TestXMLParser.swift
535+
TARGET
536+
${CMAKE_C_COMPILER_TARGET}
531537
CFLAGS
532538
-F${CMAKE_CURRENT_BINARY_DIR}
533539
LINK_FLAGS

Tools/plutil/main.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
// See http://swift.org/LICENSE.txt for license information
77
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
88
//
9-
#if os(macOS) || os(iOS)
9+
#if canImport(Darwin)
1010
import Darwin
1111
import SwiftFoundation
12-
#elseif os(Linux)
12+
#elseif canImport(Glibc)
1313
import Foundation
1414
import Glibc
15-
#elseif os(Windows)
15+
#elseif canImport(MSVCRT)
1616
import Foundation
1717
import MSVCRT
1818
#endif

0 commit comments

Comments
 (0)