Swift: under Xcode Debug options contains -O instead of nothing (or -O0)
When using Xcode as generator. -O
option is positioned even in Debug configuration.
With Xcode, I get:
- Debug:
-g -O
- Release:
-O
The expected behavior would be -g
(or -g -O0
) in Debug.
With Ninja, I get:
- Debug:
-g
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -output-file-map CMakeFiles/test.dir/Debug/output-file-map.json -incremental -j 10 -emit-executable -o test -emit-dependencies -g -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -g -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk /Users/foo/src/main.swift
- Release:
-O
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -output-file-map CMakeFiles/test.dir/Release/output-file-map.json -incremental -j 10 -emit-executable -o test -emit-dependencies -O -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -O -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk /Users/foo/src//main.swift
Minimal CMakeLists.txt
to reproduce the issue:
cmake_minimum_required(VERSION 3.12)
project(swift3 LANGUAGES Swift)
add_executable(test main.swift)
And main.swift
print("Hello world !!!")