With Xcode 8 CMake cannot detect Swift compiler
I get the following error:
Compiling the Swift compiler identification source file "CompilerId/main.swift" failed.
Compiler:
Build flags:
Id flags:
The output was:
65
=== BUILD TARGET CompilerIdSwift OF PROJECT CompilerIdSwift WITH THE DEFAULT CONFIGURATION (Debug) ===
Check dependencies
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
** BUILD FAILED **
The trick is to specify the required Swift version in the Xcode project:
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = CompilerIdSwift;
+ SWIFT_VERSION = 2.3;
};