diff options
author | Gregor Jasny <gjasny@googlemail.com> | 2017-03-28 14:04:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-03-28 20:06:29 (GMT) |
commit | c03141c04cededf6bf31d51627cd8b29c7668495 (patch) | |
tree | f88d4db6f9fc50eae5a25f64bb67f1e78eb1dc2a /Tests/SwiftMix/SwiftMain.swift | |
parent | 1adbe223cd10ee133f5137da028ed86ddef7cc4d (diff) | |
download | CMake-c03141c04cededf6bf31d51627cd8b29c7668495.zip CMake-c03141c04cededf6bf31d51627cd8b29c7668495.tar.gz CMake-c03141c04cededf6bf31d51627cd8b29c7668495.tar.bz2 |
Swift: Default to Swift 3.0 with Xcode 8.3 and later
Xcode 8.3 has dropped support for Swift 2.3 so that compiler and
feature detection failed.
Closes #16742
Diffstat (limited to 'Tests/SwiftMix/SwiftMain.swift')
-rw-r--r-- | Tests/SwiftMix/SwiftMain.swift | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Tests/SwiftMix/SwiftMain.swift b/Tests/SwiftMix/SwiftMain.swift index 3629ac8..921439a 100644 --- a/Tests/SwiftMix/SwiftMain.swift +++ b/Tests/SwiftMix/SwiftMain.swift @@ -3,10 +3,17 @@ import Foundation @objc class SwiftMainClass : NSObject { class func SwiftMain(argc:Int, argv:UnsafePointer<UnsafePointer<CChar>>) -> Int32 { dump("argc: \(argc)") +#if swift(>=3.0) + for i in 0 ..< argc { + let argi = String(cString:argv[i]); + dump("arg[\(i)]: \(argi)"); + } +#else for (var i = 0; i < argc; ++i) { let argi = String.fromCString(argv[i]) dump("arg[\(i)]: \(argi)"); } +#endif return 0; } } |