Skip to content

Commit ffc6bfb

Browse files
committed
[cmake] Allow cross-compilation of add_swift_executable targets.
Add an explicit TARGET for executable targets, to allow cross compilation and fix plutil to import Glibc also in Android.
1 parent f2c4df9 commit ffc6bfb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#if os(macOS) || os(iOS)
1010
import Darwin
1111
import SwiftFoundation
12-
#elseif os(Linux)
12+
#elseif os(Linux) || os(Android)
1313
import Foundation
1414
import Glibc
1515
#elseif os(Windows)

0 commit comments

Comments
 (0)