Swift: Disable optimization when compiling in Debug

By default no `-O...` flag is specified for Debug configuration for
Swift so Xcode adds a (wrong) `-O` flag that prevents one from accessing
variables while debugging.  Add `-Onone` to the Swift Debug
configuration to avoid this.

Fixes: #23818
This commit is contained in:
David Geldreich
2022-08-04 14:51:22 +02:00
committed by Brad King
parent 365613d98b
commit 20fe9cf7e9

View File

@@ -65,7 +65,7 @@ set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -libc MD)
set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -libc MTd)
set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -libc MDd)
set(CMAKE_Swift_FLAGS_DEBUG_INIT "-g")
set(CMAKE_Swift_FLAGS_DEBUG_INIT "-Onone -g")
set(CMAKE_Swift_FLAGS_RELEASE_INIT "-O")
set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT "-O -g")
set(CMAKE_Swift_FLAGS_MINSIZEREL_INIT "-Osize")